citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 169d3bf13fc010ee346f85b977dbe5dfdd3d87bc
parent a08bc57b8826b0178551ab48ded7bf3fed5d3836
Author: Kyle Milz <kyle@getaddrinfo.net>
Date:   Sat,  9 Apr 2016 14:04:36 -0600

src: add clang includes

Diffstat:
MJamrules | 3++-
Msrc/instrument_main.cc | 9+++++++--
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Jamrules b/Jamrules @@ -5,7 +5,8 @@ if $(OS) = OPENBSD { SHLIB_SUF = so.0.0 ; PREFIX ?= `pwd`/$(TOP) ; - C++FLAGS = -DLLVM_VER=34 -DPREFIX=$(PREFIX) ; + CLANG_INCL = "-I/usr/local/lib/clang/3.7.1/include" ; + C++FLAGS = -DLLVM_VER=34 -DPREFIX=$(PREFIX) -DCLANG_INCL=$(CLANG_INCL) ; PKG_CONFIG_LIBS = gl glew freetype2 ; # Link directly against libestdc++ from ports diff --git a/src/instrument_main.cc b/src/instrument_main.cc @@ -16,6 +16,9 @@ #include "instrument_action.h" +#define STR_EXPAND(tok) #tok +#define STR(tok) STR_EXPAND(tok) + static llvm::cl::OptionCategory ToolingCategory("instrument options"); void @@ -68,6 +71,10 @@ instrument(int argc, char *argv[], std::vector<std::string> const &source_files) // Append original command line verbatim clang_argv.insert(clang_argv.end(), argv, argv + argc); + // When instrumenting certain code clang sometimes needs its own include + // files. These are defined globally per platform. + clang_argv.push_back(STR(CLANG_INCL)); + // give clang it's <source files> -- <native command line> arg style int clang_argc = clang_argv.size(); clang::tooling::CommonOptionsParser op(clang_argc, &clang_argv[0], ToolingCategory); @@ -204,8 +211,6 @@ main(int argc, char *argv[]) // Add the runtime library and the symbol define hack // automatically to the command line modified_args.push_back(strdup(defsym_arg.str().c_str())); -#define STR_EXPAND(tok) #tok -#define STR(tok) STR_EXPAND(tok) modified_args.push_back(const_cast<char *>(STR(PREFIX) "/lib/libcitrun.so.0.0")); }