summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.rst3
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/RunClang.cxx20
3 files changed, 25 insertions, 1 deletions
diff --git a/README.rst b/README.rst
index 075dce9..24ca753 100644
--- a/README.rst
+++ b/README.rst
@@ -46,7 +46,8 @@ To build CastXML from source, first obtain the prerequisites:
* `LLVM/Clang`_ compiler SDK install tree built using the C++ compiler.
This version of CastXML has been tested with LLVM/Clang
- - SVN revision ``267153``
+ - SVN revision ``280011``
+ - Release ``3.9``
- Release ``3.8``
- Release ``3.7``
- Release ``3.6``
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 667f04e..478568c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -50,6 +50,9 @@ llvm_map_components_to_libnames(llvm_libs
support
${LLVM_TARGETS_TO_BUILD}
)
+if(WIN32)
+ list(APPEND llvm_libs version.lib)
+endif()
add_executable(castxml
castxml.cxx
diff --git a/src/RunClang.cxx b/src/RunClang.cxx
index 7024673..e2e2eee 100644
--- a/src/RunClang.cxx
+++ b/src/RunClang.cxx
@@ -50,10 +50,18 @@
#include <memory>
#include <queue>
+#if LLVM_VERSION_MAJOR > 3 \
+ || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 9
+# define CASTXML_OWNS_OSTREAM
+#endif
+
//----------------------------------------------------------------------------
class ASTConsumer: public clang::ASTConsumer
{
clang::CompilerInstance& CI;
+#ifdef CASTXML_OWNS_OSTREAM
+ std::unique_ptr<llvm::raw_ostream> OwnOS;
+#endif
llvm::raw_ostream& OS;
Options const& Opts;
struct Class {
@@ -64,9 +72,15 @@ class ASTConsumer: public clang::ASTConsumer
std::queue<Class> Classes;
int ClassImplicitMemberDepth = 0;
public:
+#ifdef CASTXML_OWNS_OSTREAM
+ ASTConsumer(clang::CompilerInstance& ci,
+ std::unique_ptr<llvm::raw_ostream> os, Options const& opts):
+ CI(ci), OwnOS(std::move(os)), OS(*OwnOS), Opts(opts) {}
+#else
ASTConsumer(clang::CompilerInstance& ci, llvm::raw_ostream& os,
Options const& opts):
CI(ci), OS(os), Opts(opts) {}
+#endif
void AddImplicitMembers(Class const& c) {
clang::CXXRecordDecl* rd = c.RD;
@@ -344,9 +358,15 @@ class CastXMLSyntaxOnlyAction:
using llvm::sys::path::filename;
if(!this->Opts.GccXml) {
return clang::SyntaxOnlyAction::CreateASTConsumer(CI, InFile);
+#ifdef CASTXML_OWNS_OSTREAM
+ } else if(std::unique_ptr<llvm::raw_ostream> OS =
+ CI.createDefaultOutputFile(false, filename(InFile), "xml")) {
+ return llvm::make_unique<ASTConsumer>(CI, std::move(OS), this->Opts);
+#else
} else if(llvm::raw_ostream* OS =
CI.createDefaultOutputFile(false, filename(InFile), "xml")) {
return llvm::make_unique<ASTConsumer>(CI, *OS, this->Opts);
+#endif
} else {
return nullptr;
}