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

[creduce-bugs] [PATCH] creduce fails to build with current LLVM/clang?==?utf-8?q? 5.0 snapshots



Hi,
creduce currently doesn't build with LLVM/clang master because of an InputKind API change.
The patch I've attached fixes it.

The chunk that adds -lLLVMSupport in a Makefile.am is a workaround for a problem with current llvm-config (erroring out unconditionally), so you may want to leave that one out (I've decided to leave it in for now because llvm-config is broken and people trying to build master will run into it too).

ttyl
bero
--- creduce-2.7.0/clang_delta/Makefile.am.omv~	2017-06-26 01:57:38.887888571 +0200
+++ creduce-2.7.0/clang_delta/Makefile.am	2017-06-26 01:58:57.514029912 +0200
@@ -112,7 +112,7 @@ clang_delta_LDADD = \
 	-lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization \
 	-lclangCodeGen -lclangParse -lclangSema -lclangAnalysis \
 	-lclangRewriteFrontend -lclangRewrite -lclangAST -lclangBasic -lclangEdit -lclangLex \
-	-lclangARCMigrate \
+	-lclangARCMigrate -lLLVMSupport \
 	$(LLVMLIBS) \
 	$(CLANG_LDFLAGS) \
 	$(LLVMLDFLAGS)
--- creduce-2.7.0/clang_delta/TransformationManager.cpp.omv~	2017-06-26 01:45:38.324911890 +0200
+++ creduce-2.7.0/clang_delta/TransformationManager.cpp	2017-06-26 01:47:31.018251368 +0200
@@ -101,16 +101,16 @@ bool TransformationManager::initializeCo
   CompilerInvocation &Invocation = ClangInstance->getInvocation();
   InputKind IK = FrontendOptions::getInputKindForExtension(
         StringRef(SrcFileName).rsplit('.').second);
-  if ((IK == IK_C) || (IK == IK_PreprocessedC)) {
-    Invocation.setLangDefaults(ClangInstance->getLangOpts(), IK_C, T, PPOpts);
+  if (IK.getLanguage() == InputKind::C) {
+    Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind::C, T, PPOpts);
   }
-  else if ((IK == IK_CXX) || (IK == IK_PreprocessedCXX)) {
+  else if (IK.getLanguage() == InputKind::CXX) {
     // ISSUE: it might cause some problems when building AST
     // for a function which has a non-declared callee, e.g., 
     // It results an empty AST for the caller. 
-    Invocation.setLangDefaults(ClangInstance->getLangOpts(), IK_CXX, T, PPOpts);
+    Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind::CXX, T, PPOpts);
   }
-  else if(IK == IK_OpenCL) {
+  else if(IK.getLanguage() == InputKind::OpenCL) {
     //Commandline parameters
     std::vector<const char*> Args;
     Args.push_back("-x");
@@ -135,7 +135,7 @@ bool TransformationManager::initializeCo
                                        &Args[0], &Args[0] + Args.size(),
                                        ClangInstance->getDiagnostics());
     Invocation.setLangDefaults(ClangInstance->getLangOpts(),
-                               IK_OpenCL, T, PPOpts);
+                               InputKind::OpenCL, T, PPOpts);
   }
   else {
     ErrorMsg = "Unsupported file type!";