update for change in clang's DiagnosticOptions
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 30 Oct 2012 22:15:41 +0000 (23:15 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 4 Nov 2012 21:15:03 +0000 (22:15 +0100)
DiagnosticOptions was moved from Frontend to Basic and
createDiagnostics now takes a pointer to a DiagnosticOptions object.

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

index 68e3167..5ec7f7b 100644 (file)
@@ -164,6 +164,9 @@ system)
                           [Return type of HandleTopLevelDeclReturn])
                 AC_DEFINE([HandleTopLevelDeclContinue], [true],
                           [Return type of HandleTopLevelDeclReturn])])
+       AC_CHECK_HEADER([clang/Basic/DiagnosticOptions.h],
+               [AC_DEFINE([HAVE_BASIC_DIAGNOSTICOPTIONS_H], [],
+                          [Define if clang/Basic/DiagnosticOptions.h exists])])
        AC_LANG_POP
        CPPFLAGS="$SAVE_CPPFLAGS"
 
index 1e631dc..9154222 100644 (file)
@@ -31,6 +31,8 @@
  * Sven Verdoolaege.
  */ 
 
+#include "isl_config.h"
+
 #include <assert.h>
 #include <iostream>
 #include <llvm/Support/raw_ostream.h>
 #include <clang/Driver/Tool.h>
 #include <clang/Frontend/CompilerInstance.h>
 #include <clang/Frontend/CompilerInvocation.h>
+#ifdef HAVE_BASIC_DIAGNOSTICOPTIONS_H
+#include <clang/Basic/DiagnosticOptions.h>
+#else
 #include <clang/Frontend/DiagnosticOptions.h>
+#endif
 #include <clang/Frontend/TextDiagnosticPrinter.h>
 #include <clang/Frontend/Utils.h>
 #include <clang/Lex/HeaderSearch.h>
@@ -57,7 +63,6 @@
 #include <clang/Parse/ParseAST.h>
 #include <clang/Sema/Sema.h>
 
-#include "isl_config.h"
 #include "extract_interface.h"
 #include "python.h"
 
@@ -188,14 +193,29 @@ static CompilerInvocation *construct_invocation(const char *filename,
 
 #endif
 
+#ifdef HAVE_BASIC_DIAGNOSTICOPTIONS_H
+
+static TextDiagnosticPrinter *construct_printer(void)
+{
+       return new TextDiagnosticPrinter(llvm::errs(), new DiagnosticOptions());
+}
+
+#else
+
+static TextDiagnosticPrinter *construct_printer(void)
+{
+       DiagnosticOptions DO;
+       return new TextDiagnosticPrinter(llvm::errs(), DO);
+}
+
+#endif
+
 int main(int argc, char *argv[])
 {
        llvm::cl::ParseCommandLineOptions(argc, argv);
 
        CompilerInstance *Clang = new CompilerInstance();
-       DiagnosticOptions DO;
-       Clang->createDiagnostics(0, NULL,
-                               new TextDiagnosticPrinter(llvm::errs(), DO));
+       Clang->createDiagnostics(0, NULL, construct_printer());
        DiagnosticsEngine &Diags = Clang->getDiagnostics();
        Diags.setSuppressSystemWarnings(true);
        CompilerInvocation *invocation =