update for change in arguments of clang's CompilerInstance::createDiagnostics
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 7 Apr 2013 11:13:14 +0000 (7 13:13 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 7 Apr 2013 13:50:45 +0000 (7 15:50 +0200)
In particular, CompilerInstance::createDiagnostics no longer takes
argc and argv as arugments.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
configure.ac
interface/extract_interface.cc

index 88de460..baf2027 100644 (file)
@@ -177,6 +177,13 @@ system)
                TargetInfo::CreateTargetInfo(*Diags, TO);
        ], [AC_DEFINE([CREATETARGETINFO_TAKES_POINTER], [],
                      [Define if TargetInfo::CreateTargetInfo takes pointer])])
+       AC_TRY_COMPILE([#include <clang/Frontend/CompilerInstance.h>], [
+               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"
 
index a050293..acf7c85 100644 (file)
@@ -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 =