From da67c73305ad02c118b3234ee52dbbc00677f3a3 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 7 Apr 2013 13:13:14 +0200 Subject: [PATCH] update for change in arguments of clang's CompilerInstance::createDiagnostics In particular, CompilerInstance::createDiagnostics no longer takes argc and argv as arugments. Signed-off-by: Sven Verdoolaege --- configure.ac | 7 +++++++ interface/extract_interface.cc | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 88de460e..baf2027f 100644 --- a/configure.ac +++ b/configure.ac @@ -177,6 +177,13 @@ system) TargetInfo::CreateTargetInfo(*Diags, TO); ], [AC_DEFINE([CREATETARGETINFO_TAKES_POINTER], [], [Define if TargetInfo::CreateTargetInfo takes pointer])]) + AC_TRY_COMPILE([#include ], [ + using namespace clang; + DiagnosticConsumer *client; + CompilerInstance *Clang; + Clang->createDiagnostics(client); + ], [], [AC_DEFINE([CREATEDIAGNOSTICS_TAKES_ARG], [], + [Define if CompilerInstance::createDiagnostics takes argc and argv])]) AC_LANG_POP CPPFLAGS="$SAVE_CPPFLAGS" diff --git a/interface/extract_interface.cc b/interface/extract_interface.cc index a050293f..acf7c85c 100644 --- a/interface/extract_interface.cc +++ b/interface/extract_interface.cc @@ -238,12 +238,28 @@ static TargetInfo *create_target_info(CompilerInstance *Clang, #endif +#ifdef CREATEDIAGNOSTICS_TAKES_ARG + +static void create_diagnostics(CompilerInstance *Clang) +{ + Clang->createDiagnostics(0, NULL, construct_printer()); +} + +#else + +static void create_diagnostics(CompilerInstance *Clang) +{ + Clang->createDiagnostics(construct_printer()); +} + +#endif + int main(int argc, char *argv[]) { llvm::cl::ParseCommandLineOptions(argc, argv); CompilerInstance *Clang = new CompilerInstance(); - Clang->createDiagnostics(0, NULL, construct_printer()); + create_diagnostics(Clang); DiagnosticsEngine &Diags = Clang->getDiagnostics(); Diags.setSuppressSystemWarnings(true); CompilerInvocation *invocation = -- 2.11.4.GIT