pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/devel/creduce creduce: fix build with llvm-12



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7601cdee85ba
branches:  trunk
changeset: 455910:7601cdee85ba
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Wed Jul 14 09:08:48 2021 +0000

description:
creduce: fix build with llvm-12

>From https://github.com/csmith-project/creduce/tree/llvm-12.0-dev

diffstat:

 devel/creduce/Makefile                                                     |   4 +-
 devel/creduce/distinfo                                                     |  10 +-
 devel/creduce/patches/patch-clang__delta_CommonRenameClassRewriteVisitor.h |  24 +++
 devel/creduce/patches/patch-clang__delta_Makefile.am                       |  17 --
 devel/creduce/patches/patch-clang__delta_Makefile.in                       |  17 --
 devel/creduce/patches/patch-clang__delta_RemoveNamespace.cpp               |  15 ++
 devel/creduce/patches/patch-clang__delta_RewriteUtils.cpp                  |  26 ++++
 devel/creduce/patches/patch-clang__delta_Transformation.cpp                |  24 +++
 devel/creduce/patches/patch-clang__delta_TransformationManager.cpp         |  61 ++++-----
 9 files changed, 123 insertions(+), 75 deletions(-)

diffs (280 lines):

diff -r 3d20984144bc -r 7601cdee85ba devel/creduce/Makefile
--- a/devel/creduce/Makefile    Wed Jul 14 08:29:19 2021 +0000
+++ b/devel/creduce/Makefile    Wed Jul 14 09:08:48 2021 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.16 2021/05/24 19:49:54 wiz Exp $
+# $NetBSD: Makefile,v 1.17 2021/07/14 09:08:48 wiz Exp $
 
 DISTNAME=      creduce-2.10.0
-PKGREVISION=   7
+PKGREVISION=   8
 CATEGORIES=    devel
 MASTER_SITES=  https://embed.cs.utah.edu/creduce/
 
diff -r 3d20984144bc -r 7601cdee85ba devel/creduce/distinfo
--- a/devel/creduce/distinfo    Wed Jul 14 08:29:19 2021 +0000
+++ b/devel/creduce/distinfo    Wed Jul 14 09:08:48 2021 +0000
@@ -1,9 +1,11 @@
-$NetBSD: distinfo,v 1.8 2020/04/20 16:33:51 adam Exp $
+$NetBSD: distinfo,v 1.9 2021/07/14 09:08:48 wiz Exp $
 
 SHA1 (creduce-2.10.0.tar.gz) = 77c3dafb2446133ca2f2aeae34b2e4b79de5231d
 RMD160 (creduce-2.10.0.tar.gz) = 183be95aec282812724ec66204952ad33dbc923b
 SHA512 (creduce-2.10.0.tar.gz) = f2f2cc498cbf78331ea62e533579c84042ddc1ad8eb146adeae6b3a833e0ea4bb26a4ab5f1f61a30500a5a0c9c89cc1d4e4c8547aa9e4a14d3b5d744aeb4f6a7
 Size (creduce-2.10.0.tar.gz) = 779318 bytes
-SHA1 (patch-clang__delta_Makefile.am) = 6eac9443bb954c9fb54a922d6da909cf0a45d25d
-SHA1 (patch-clang__delta_Makefile.in) = c650aab0534268a67615d9360934534ea1d36b90
-SHA1 (patch-clang__delta_TransformationManager.cpp) = 40171540ed976c14ec3a9d249e8e8ed96d3e8a88
+SHA1 (patch-clang__delta_CommonRenameClassRewriteVisitor.h) = 66527a9c3e0bf8ff778c9a57eb20cda596223300
+SHA1 (patch-clang__delta_RemoveNamespace.cpp) = 82eb6a625a27edfac93d5727c5dde7d1382d68bb
+SHA1 (patch-clang__delta_RewriteUtils.cpp) = 56b8f4d19189019c4dcc83b315a1cfd2ff459955
+SHA1 (patch-clang__delta_Transformation.cpp) = b04a80569552639c529251dc450defefbd8f2e93
+SHA1 (patch-clang__delta_TransformationManager.cpp) = 322e64726dc0301832824caf228da6faf8bb6ae8
diff -r 3d20984144bc -r 7601cdee85ba devel/creduce/patches/patch-clang__delta_CommonRenameClassRewriteVisitor.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/creduce/patches/patch-clang__delta_CommonRenameClassRewriteVisitor.h        Wed Jul 14 09:08:48 2021 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-clang__delta_CommonRenameClassRewriteVisitor.h,v 1.1 2021/07/14 09:08:49 wiz Exp $
+
+Build fix for llvm 12.0.1 from https://github.com/csmith-project/creduce/tree/llvm-12.0-dev
+
+--- clang_delta/CommonRenameClassRewriteVisitor.h.orig 2019-05-13 21:17:30.000000000 +0000
++++ clang_delta/CommonRenameClassRewriteVisitor.h
+@@ -98,7 +98,7 @@ bool CommonRenameClassRewriteVisitor<T>:
+     return true;
+ 
+   IdentifierInfo *IdInfo = DeclName.getAsIdentifierInfo();
+-  std::string IdName = IdInfo->getName();
++  std::string IdName = IdInfo->getName().str();
+   std::string Name;
+   if (getNewNameByName(IdName, Name)) {
+     SourceLocation LocStart = NameInfo.getBeginLoc();
+@@ -332,7 +332,7 @@ template<typename T> bool CommonRenameCl
+   TransAssert(DTST && "Bad DependentTemplateSpecializationType!");
+ 
+   const IdentifierInfo *IdInfo = DTST->getIdentifier();
+-  std::string IdName = IdInfo->getName();
++  std::string IdName = IdInfo->getName().str();
+   std::string Name;
+   if (getNewNameByName(IdName, Name)) {
+     SourceLocation LocStart = DTSLoc.getTemplateNameLoc();
diff -r 3d20984144bc -r 7601cdee85ba devel/creduce/patches/patch-clang__delta_Makefile.am
--- a/devel/creduce/patches/patch-clang__delta_Makefile.am      Wed Jul 14 08:29:19 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-$NetBSD: patch-clang__delta_Makefile.am,v 1.2 2018/03/31 20:09:10 joerg Exp $
-
---- clang_delta/Makefile.am.orig       2017-05-18 16:42:08.000000000 +0000
-+++ clang_delta/Makefile.am
-@@ -107,12 +107,9 @@ clang_delta_CXXFLAGS = \
- # libraries.  So probably, we could move `LLVMLDFLAGS' back to the definition
- # of `clang_delta_LDFLAGS'.  I'll do that later.
- clang_delta_LDADD = \
--      -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers \
--      -lclangStaticAnalyzerCore \
-       -lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization \
-       -lclangCodeGen -lclangParse -lclangSema -lclangAnalysis \
-       -lclangRewriteFrontend -lclangRewrite -lclangAST -lclangBasic -lclangEdit -lclangLex \
--      -lclangARCMigrate \
-       $(LLVMLIBS) \
-       $(CLANG_LDFLAGS) \
-       $(LLVMLDFLAGS)
diff -r 3d20984144bc -r 7601cdee85ba devel/creduce/patches/patch-clang__delta_Makefile.in
--- a/devel/creduce/patches/patch-clang__delta_Makefile.in      Wed Jul 14 08:29:19 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-$NetBSD: patch-clang__delta_Makefile.in,v 1.2 2018/03/31 20:09:10 joerg Exp $
-
---- clang_delta/Makefile.in.orig       2017-05-18 16:42:08.000000000 +0000
-+++ clang_delta/Makefile.in
-@@ -502,12 +502,9 @@ clang_delta_CXXFLAGS = \
- # libraries.  So probably, we could move `LLVMLDFLAGS' back to the definition
- # of `clang_delta_LDFLAGS'.  I'll do that later.
- clang_delta_LDADD = \
--      -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers \
--      -lclangStaticAnalyzerCore \
-       -lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization \
-       -lclangCodeGen -lclangParse -lclangSema -lclangAnalysis \
-       -lclangRewriteFrontend -lclangRewrite -lclangAST -lclangBasic -lclangEdit -lclangLex \
--      -lclangARCMigrate \
-       $(LLVMLIBS) \
-       $(CLANG_LDFLAGS) \
-       $(LLVMLDFLAGS)
diff -r 3d20984144bc -r 7601cdee85ba devel/creduce/patches/patch-clang__delta_RemoveNamespace.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/creduce/patches/patch-clang__delta_RemoveNamespace.cpp      Wed Jul 14 09:08:48 2021 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-clang__delta_RemoveNamespace.cpp,v 1.1 2021/07/14 09:08:49 wiz Exp $
+
+Build fix for llvm 12.0.1 from https://github.com/csmith-project/creduce/tree/llvm-12.0-dev
+
+--- clang_delta/RemoveNamespace.cpp.orig       2019-05-13 21:17:30.000000000 +0000
++++ clang_delta/RemoveNamespace.cpp
+@@ -458,7 +458,7 @@ bool RemoveNamespaceRewriteVisitor::Visi
+   TransAssert(DTST && "Bad DependentTemplateSpecializationType!");
+ 
+   const IdentifierInfo *IdInfo = DTST->getIdentifier();
+-  std::string IdName = IdInfo->getName();
++  std::string IdName = IdInfo->getName().str();
+   std::string Name;
+ 
+   // FIXME:
diff -r 3d20984144bc -r 7601cdee85ba devel/creduce/patches/patch-clang__delta_RewriteUtils.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/creduce/patches/patch-clang__delta_RewriteUtils.cpp Wed Jul 14 09:08:48 2021 +0000
@@ -0,0 +1,26 @@
+$NetBSD: patch-clang__delta_RewriteUtils.cpp,v 1.3 2021/07/14 09:08:49 wiz Exp $
+
+Build fix for llvm 12.0.1 from https://github.com/csmith-project/creduce/tree/llvm-12.0-dev
+
+--- clang_delta/RewriteUtils.cpp.orig  2019-05-13 21:17:30.000000000 +0000
++++ clang_delta/RewriteUtils.cpp
+@@ -718,8 +718,8 @@ std::string RewriteUtils::getStmtIndentS
+   StringRef MB = SrcManager->getBufferData(FID);
+  
+   unsigned lineNo = SrcManager->getLineNumber(FID, StartOffset) - 1;
+-  const SrcMgr::ContentCache *
+-      Content = SrcManager->getSLocEntry(FID).getFile().getContentCache();
++  const SrcMgr::ContentCache *Content =
++    &SrcManager->getSLocEntry(FID).getFile().getContentCache();
+   unsigned lineOffs = Content->SourceLineCache[lineNo];
+  
+   // Find the whitespace at the start of the line.
+@@ -730,7 +730,7 @@ std::string RewriteUtils::getStmtIndentS
+     ++I;
+   indentSpace = MB.substr(lineOffs, I-lineOffs);
+ 
+-  return indentSpace;
++  return indentSpace.str();
+ }
+ 
+ bool RewriteUtils::addLocalVarToFunc(const std::string &VarStr,
diff -r 3d20984144bc -r 7601cdee85ba devel/creduce/patches/patch-clang__delta_Transformation.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/creduce/patches/patch-clang__delta_Transformation.cpp       Wed Jul 14 09:08:48 2021 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-clang__delta_Transformation.cpp,v 1.1 2021/07/14 09:08:49 wiz Exp $
+
+Build fix for llvm 12.0.1 from https://github.com/csmith-project/creduce/tree/llvm-12.0-dev
+
+--- clang_delta/Transformation.cpp.orig        2019-05-13 21:17:30.000000000 +0000
++++ clang_delta/Transformation.cpp
+@@ -106,7 +106,7 @@ void Transformation::outputTransformedSo
+ void Transformation::outputOriginalSource(llvm::raw_ostream &OutStream)
+ {
+   FileID MainFileID = SrcManager->getMainFileID();
+-  const llvm::MemoryBuffer *MainBuf = SrcManager->getBuffer(MainFileID);
++  auto MainBuf = SrcManager->getBufferOrNone(MainFileID);
+   TransAssert(MainBuf && "Empty MainBuf!");
+   OutStream << MainBuf->getBufferStart();
+   OutStream.flush();
+@@ -357,7 +357,7 @@ unsigned int Transformation::getConstArr
+   llvm::SmallString<8> IntStr;
+   Result.toStringUnsigned(IntStr);
+ 
+-  std::stringstream TmpSS(IntStr.str());
++  std::stringstream TmpSS(IntStr.str().str());
+ 
+   if (!(TmpSS >> Sz)) {
+     TransAssert(0 && "Non-integer value!");
diff -r 3d20984144bc -r 7601cdee85ba devel/creduce/patches/patch-clang__delta_TransformationManager.cpp
--- a/devel/creduce/patches/patch-clang__delta_TransformationManager.cpp        Wed Jul 14 08:29:19 2021 +0000
+++ b/devel/creduce/patches/patch-clang__delta_TransformationManager.cpp        Wed Jul 14 09:08:48 2021 +0000
@@ -1,46 +1,45 @@
-$NetBSD: patch-clang__delta_TransformationManager.cpp,v 1.6 2020/04/20 16:33:51 adam Exp $
+$NetBSD: patch-clang__delta_TransformationManager.cpp,v 1.7 2021/07/14 09:08:49 wiz Exp $
 
-Port to LLVM 10.0
-https://github.com/csmith-project/creduce/pull/204/
+Build fix for llvm 12.0.1 from https://github.com/csmith-project/creduce/tree/llvm-12.0-dev
 
 --- clang_delta/TransformationManager.cpp.orig 2019-05-13 21:17:30.000000000 +0000
 +++ clang_delta/TransformationManager.cpp
-@@ -16,6 +16,7 @@
+@@ -16,9 +16,12 @@
  
  #include <sstream>
  
 +#include "clang/Basic/Builtins.h"
  #include "clang/Basic/Diagnostic.h"
++#include "clang/Basic/FileManager.h"
  #include "clang/Basic/TargetInfo.h"
  #include "clang/Lex/Preprocessor.h"
-@@ -101,6 +102,7 @@ bool TransformationManager::initializeCo
++#include "clang/Lex/PreprocessorOptions.h"
+ #include "clang/Frontend/CompilerInstance.h"
+ #include "clang/Parse/ParseAST.h"
+ 
+@@ -101,16 +104,16 @@ bool TransformationManager::initializeCo
    CompilerInvocation &Invocation = ClangInstance->getInvocation();
    InputKind IK = FrontendOptions::getInputKindForExtension(
          StringRef(SrcFileName).rsplit('.').second);
-+#if LLVM_VERSION_MAJOR < 10
-   if (IK.getLanguage() == InputKind::C) {
-     Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind::C, T, PPOpts);
-   }
-@@ -111,6 +113,18 @@ bool TransformationManager::initializeCo
-     Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind::CXX, T, PPOpts);
-   }
-   else if(IK.getLanguage() == InputKind::OpenCL) {
-+#else
+-  if (IK.getLanguage() == InputKind::C) {
+-    Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind::C, T, PPOpts);
 +  if (IK.getLanguage() == Language::C) {
-+    Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind(Language::C), T, PPOpts);
-+  }
++    Invocation.setLangDefaults(ClangInstance->getLangOpts(), Language::C, T, PPOpts.Includes);
+   }
+-  else if (IK.getLanguage() == InputKind::CXX) {
 +  else if (IK.getLanguage() == Language::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(), InputKind(Language::CXX), T, PPOpts);
-+  }
+     // 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(), InputKind::CXX, T, PPOpts);
++    Invocation.setLangDefaults(ClangInstance->getLangOpts(), Language::CXX, T, PPOpts.Includes);
+   }
+-  else if(IK.getLanguage() == InputKind::OpenCL) {
 +  else if(IK.getLanguage() == Language::OpenCL) {
-+#endif
      //Commandline parameters
      std::vector<const char*> Args;
      Args.push_back("-x");
-@@ -122,7 +136,7 @@ bool TransformationManager::initializeCo
+@@ -122,7 +125,7 @@ bool TransformationManager::initializeCo
      ClangInstance->createFileManager();
  
      if(CLCPath != NULL && ClangInstance->hasFileManager() &&
@@ -49,24 +48,16 @@
          Args.push_back("-I");
          Args.push_back(CLCPath);
      }
-@@ -132,10 +146,19 @@ bool TransformationManager::initializeCo
+@@ -132,10 +135,10 @@ bool TransformationManager::initializeCo
      Args.push_back("-fno-builtin");
  
      CompilerInvocation::CreateFromArgs(Invocation,
-+#if LLVM_VERSION_MAJOR >= 10
-+                                       Args,
-+#else
-                                        &Args[0], &Args[0] + Args.size(),
-+#endif
+-                                       &Args[0], &Args[0] + Args.size(),
++                                     ArrayRef<const char*>(&Args[0], &Args[0] + Args.size()),
                                         ClangInstance->getDiagnostics());
      Invocation.setLangDefaults(ClangInstance->getLangOpts(),
 -                               InputKind::OpenCL, T, PPOpts);
-+#if LLVM_VERSION_MAJOR >= 10
-+                               InputKind(Language::OpenCL),
-+#else
-+                               InputKind::OpenCL,
-+#endif
-+                             T, PPOpts);
++                               Language::OpenCL, T, PPOpts.Includes);
    }
    else {
      ErrorMsg = "Unsupported file type!";



Home | Main Index | Thread Index | Old Index