diff options
author | Brad King <brad.king@kitware.com> | 2015-06-29 14:04:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-06-29 17:21:28 (GMT) |
commit | e733b8c0d536b4b7e027a3b46c6bd235cd0754d0 (patch) | |
tree | f37081d53d9cd136da8e5fd73de825e3b130fddd | |
parent | 96c18defee8748369597de557fe0d221c3d2f16c (diff) | |
download | CastXML-e733b8c0d536b4b7e027a3b46c6bd235cd0754d0.zip CastXML-e733b8c0d536b4b7e027a3b46c6bd235cd0754d0.tar.gz CastXML-e733b8c0d536b4b7e027a3b46c6bd235cd0754d0.tar.bz2 |
Port to LLVM/Clang SVN r240941 (trunk)
Update use of the llvm::opt::OptTable::ParseArgs method and the
llvm::cl::ExpandResponseFiles function to account for post-3.6 changes
to the LLVM/Clang API. Use preprocessor conditions so that we can
continue to build against LLVM/Clang 3.6 too.
-rw-r--r-- | README.rst | 2 | ||||
-rw-r--r-- | src/RunClang.cxx | 10 | ||||
-rw-r--r-- | src/castxml.cxx | 13 |
3 files changed, 24 insertions, 1 deletions
@@ -47,7 +47,7 @@ To build CastXML from source, first obtain the prerequisites: This version of CastXML has been tested with LLVM/Clang - Release ``3.6.0`` - - SVN revision ``234175`` + - SVN revision ``240941`` * Optionally, the `Sphinx`_ documentation generator to build documentation. diff --git a/src/RunClang.cxx b/src/RunClang.cxx index 1d38de4..54535c0 100644 --- a/src/RunClang.cxx +++ b/src/RunClang.cxx @@ -21,6 +21,8 @@ #include <cxsys/SystemTools.hxx> +#include "llvm/Config/llvm-config.h" + #include "clang/AST/ASTConsumer.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" @@ -267,9 +269,17 @@ runClangCreateDiagnostics(const char* const* argBeg, const char* const* argEnd) std::unique_ptr<llvm::opt::OptTable> opts(clang::driver::createDriverOptTable()); unsigned missingArgIndex, missingArgCount; +#if LLVM_VERSION_MAJOR > 3 \ + || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7 + llvm::opt::InputArgList + args(opts->ParseArgs(llvm::makeArrayRef(argBeg, argEnd), + missingArgIndex, missingArgCount)); + clang::ParseDiagnosticArgs(*diagOpts, args); +#else std::unique_ptr<llvm::opt::InputArgList> args(opts->ParseArgs(argBeg, argEnd, missingArgIndex, missingArgCount)); clang::ParseDiagnosticArgs(*diagOpts, *args); +#endif clang::TextDiagnosticPrinter* diagClient = new clang::TextDiagnosticPrinter(llvm::errs(), &*diagOpts); llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diff --git a/src/castxml.cxx b/src/castxml.cxx index 12ab336..bd05beb 100644 --- a/src/castxml.cxx +++ b/src/castxml.cxx @@ -19,6 +19,8 @@ #include "RunClang.h" #include "Utils.h" +#include "llvm/Config/llvm-config.h" + #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/CommandLine.h" @@ -33,6 +35,10 @@ #include <vector> #include <string.h> +#if LLVM_VERSION_MAJOR > 3 \ + || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7 +# include "llvm/Support/StringSaver.h" +#else class StringSaver: public llvm::cl::StringSaver { std::set<std::string> Strings; public: @@ -40,6 +46,7 @@ public: return this->Strings.insert(s).first->c_str(); } }; +#endif //---------------------------------------------------------------------------- int main(int argc_in, const char** argv_in) @@ -63,7 +70,13 @@ int main(int argc_in, const char** argv_in) return 1; } +#if LLVM_VERSION_MAJOR > 3 \ + || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7 + llvm::BumpPtrAllocator argSaverAlloc; + llvm::BumpPtrStringSaver argSaver(argSaverAlloc); +#else StringSaver argSaver; +#endif llvm::cl::ExpandResponseFiles( argSaver, llvm::cl::TokenizeGNUCommandLine, argv); |