[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[creduce-dev] More llvm-svn changes required?

LLVM no longer installs "llvm/Config/config.h", which is good, considering it used to cause macro redefinition conflicts with other autoconf headers.

LLVM also no longer has the raw_fd_ostream overload it used to have.

Clang also uses unique_ptr in setASTConsumer. I think this diff used to be in creduce but got lost somewhere along the way.

Should this be applied to a new llvm-svn-compatible branch?
diff --git a/clang_delta/TransformationManager.cpp b/clang_delta/TransformationManager.cpp
index e677930..a06e600 100644
--- a/clang_delta/TransformationManager.cpp
+++ b/clang_delta/TransformationManager.cpp
@@ -22,6 +22,21 @@
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Parse/ParseAST.h"
+ * Avoid a bunch of warnings about redefinitions of PACKAGE_* symbols.
+ *
+ * The definitions of these symbols are produced by Autoconf et al.
+ * For C-Reduce, we define these in <config.h>.
+ * LLVM defines these symbols in "llvm/Config/config.h".
+ * But we don't care anything about these symbols in this source file.
+ */
+#include "llvm/Config/config.h"
 #include "Transformation.h"
 using namespace clang;
@@ -109,8 +124,7 @@ bool TransformationManager::initializeCompilerInstance(std::string &ErrorMsg)
   assert(CurrentTransformationImpl && "Bad transformation instance!");
-  ClangInstance->setASTConsumer(
-    std::unique_ptr<ASTConsumer>(CurrentTransformationImpl));
+  ClangInstance->setASTConsumer(CurrentTransformationImpl);
   Preprocessor &PP = ClangInstance->getPreprocessor();
@@ -149,10 +163,10 @@ llvm::raw_ostream *TransformationManager::getOutStream()
   if (OutputFileName.empty())
     return &(llvm::outs());
-  std::error_code EC;
+  std::string ES;
   llvm::raw_fd_ostream *Out = new llvm::raw_fd_ostream(
-      OutputFileName, EC, llvm::sys::fs::F_RW);
-  assert(!EC && "Cannot open output file!");
+      OutputFileName.c_str(), ES, llvm::sys::fs::F_RW);
+  assert(ES == "" && "Cannot open output file!");
   return Out;