From a0427a68dace69026902d02307ace0575f85584e Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 31 Aug 2014 10:13:12 +0200 Subject: [PATCH] update for removal of llvm/ADT/OwningPtr.h The llvm/ADT/OwningPtr.h header has been removed in recent versions of clang. These versions can only be compiled with a C++11 compiler, so if this header is missing then we may assume that we can use std::unique_ptr. Signed-off-by: Sven Verdoolaege --- configure.ac | 3 +++ pet.cc | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 307347c..a1c7fca 100644 --- a/configure.ac +++ b/configure.ac @@ -151,6 +151,9 @@ AC_EGREP_HEADER([DecayedType], [clang/AST/Type.h], AC_EGREP_HEADER([setMainFileID], [clang/Basic/SourceManager.h], [AC_DEFINE([HAVE_SETMAINFILEID], [], [Define if SourceManager has a setMainFileID method])]) +AC_CHECK_HEADER([llvm/ADT/OwningPtr.h], + [AC_DEFINE([HAVE_ADT_OWNINGPTR_H], [], + [Define if llvm/ADT/OwningPtr.h exists])]) AC_LANG_POP CPPFLAGS="$SAVE_CPPFLAGS" diff --git a/pet.cc b/pet.cc index 5a5b54c..071049f 100644 --- a/pet.cc +++ b/pet.cc @@ -38,7 +38,11 @@ #include #include #include +#ifdef HAVE_ADT_OWNINGPTR_H #include +#else +#include +#endif #include #include #include @@ -96,6 +100,10 @@ using namespace std; using namespace clang; using namespace clang::driver; +#ifdef HAVE_ADT_OWNINGPTR_H +#define unique_ptr llvm::OwningPtr +#endif + /* Called if we found something we didn't expect in one of the pragmas. * We'll provide more informative warnings later. */ @@ -766,11 +774,11 @@ static CompilerInvocation *construct_invocation(const char *filename, DiagnosticsEngine &Diags) { const char *binary = CLANG_PREFIX"/bin/clang"; - const llvm::OwningPtr driver(construct_driver(binary, Diags)); + const unique_ptr driver(construct_driver(binary, Diags)); std::vector Argv; Argv.push_back(binary); Argv.push_back(filename); - const llvm::OwningPtr compilation( + const unique_ptr compilation( driver->BuildCompilation(llvm::ArrayRef(Argv))); JobList &Jobs = compilation->getJobs(); if (Jobs.size() < 1) -- 2.11.4.GIT