From 06e1afb5e1afb58b4dc4de29cabaffbd583a906b Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 7 Apr 2013 14:10:29 +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 +++++++ pet.cc | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 877ccc0..a6933a9 100644 --- a/configure.ac +++ b/configure.ac @@ -105,6 +105,13 @@ AC_EGREP_HEADER([findLocationAfterToken], [clang/Lex/Lexer.h], AC_EGREP_HEADER([translateLineCol], [clang/Basic/SourceManager.h], [AC_DEFINE([HAVE_TRANSLATELINECOL], [], [Define if SourceManager has translateLineCol method])]) +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/pet.cc b/pet.cc index 7acaa76..5a678a1 100644 --- a/pet.cc +++ b/pet.cc @@ -689,6 +689,22 @@ static TargetInfo *create_target_info(CompilerInstance *Clang, #endif +#ifdef CREATEDIAGNOSTICS_TAKES_ARG + +static void create_diagnostics(CompilerInstance *Clang) +{ + Clang->createDiagnostics(0, NULL); +} + +#else + +static void create_diagnostics(CompilerInstance *Clang) +{ + Clang->createDiagnostics(); +} + +#endif + /* Extract a pet_scop from the C source file called "filename". * If "function" is not NULL, extract the pet_scop from the function * with that name. @@ -712,7 +728,7 @@ static struct pet_scop *scop_extract_from_C_source(isl_ctx *ctx, isl_union_map *value_bounds; CompilerInstance *Clang = new CompilerInstance(); - Clang->createDiagnostics(0, NULL); + create_diagnostics(Clang); DiagnosticsEngine &Diags = Clang->getDiagnostics(); Diags.setSuppressSystemWarnings(true); CompilerInvocation *invocation = construct_invocation(filename, Diags); -- 2.11.4.GIT