citrun

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

commit 2e03ab70931ecb3ed13a678a2487a8d97d1c6460
parent 73651311649f93ba9a3d4288d5b5d263457acc5a
Author: Kyle Milz <kyle@getaddrinfo.net>
Date:   Tue, 29 Mar 2016 22:43:25 -0600

convert preprocessor test to version, not platform

Diffstat:
MJamrules | 4+++-
Minstrument/instrument_action.cc | 4++--
Minstrument/instrument_action.h | 2+-
Minstrument/main.cc | 2+-
4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Jamrules b/Jamrules @@ -4,6 +4,8 @@ if $(OS) = OPENBSD { C++ = eg++ ; SHLIB_SUF = so.0.0 ; + C++FLAGS = -DLLVM_VER=34 ; + PKG_CONFIG_LIBS = gl glew freetype2 ; # Link directly against libestdc++ from ports LINKLIBS on scv_viewer = -lestdc++ -lm -lglut ; @@ -30,7 +32,7 @@ if $(OS) = OPENBSD { if $(OS) = MACOSX { SHLIB_SUF = 0.dylib ; - C++FLAGS = -Wno-deprecated ; + C++FLAGS = -Wno-deprecated -DLLVM_VER=37 ; PKG_CONFIG_LIBS = glew freetype2 ; LINKLIBS on scv_viewer = -framework OpenGL -framework GLUT ; diff --git a/instrument/instrument_action.cc b/instrument/instrument_action.cc @@ -15,7 +15,7 @@ #include "runtime_h.h" -#ifdef __APPLE__ +#if LLVM_VER > 35 std::unique_ptr<clang::ASTConsumer> #else clang::ASTConsumer * @@ -28,7 +28,7 @@ InstrumentAction::CreateASTConsumer(clang::CompilerInstance &CI, clang::StringRe // Hang onto a reference to this so we can read from it later InstrumentASTConsumer = new RewriteASTConsumer(TheRewriter); -#ifdef __APPLE__ +#if LLVM_VER > 35 return std::unique_ptr<clang::ASTConsumer>(InstrumentASTConsumer); #else return InstrumentASTConsumer; diff --git a/instrument/instrument_action.h b/instrument/instrument_action.h @@ -30,7 +30,7 @@ public: InstrumentAction() {}; void EndSourceFileAction() override; -#ifdef __APPLE__ +#if LLVM_VER > 35 std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance &, clang::StringRef) override; #else clang::ASTConsumer *CreateASTConsumer(clang::CompilerInstance &, clang::StringRef) override; diff --git a/instrument/main.cc b/instrument/main.cc @@ -81,7 +81,7 @@ instrument(int argc, char *argv[], std::vector<std::string> const &source_files) // that will return a new MyFrontendAction object every time. To // further customize this, we could create our own factory class. // int ret = Tool.run(new MFAF(inst_files)); -#ifdef __APPLE__ +#if LLVM_VER > 35 int ret = Tool.run(&(*clang::tooling::newFrontendActionFactory<InstrumentAction>())); #else int ret = Tool.run(clang::tooling::newFrontendActionFactory<InstrumentAction>());