commit:     400e84dbd725778f242320820c530c7e3c322488
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  4 16:46:51 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Oct  4 17:07:17 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=400e84db

dev-util/creduce: backport LLVM-7 support patch

Bug: https://bugs.gentoo.org/667556
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../creduce/creduce-2.8.0_pre20180411-r1.ebuild    | 44 +++++++++++
 dev-util/creduce/files/creduce-llvm-7.patch        | 90 ++++++++++++++++++++++
 2 files changed, 134 insertions(+)

diff --git a/dev-util/creduce/creduce-2.8.0_pre20180411-r1.ebuild 
b/dev-util/creduce/creduce-2.8.0_pre20180411-r1.ebuild
new file mode 100644
index 00000000000..fec31d8e891
--- /dev/null
+++ b/dev-util/creduce/creduce-2.8.0_pre20180411-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+: ${CMAKE_MAKEFILE_GENERATOR=ninja}
+inherit cmake-utils llvm
+
+EGIT_COMMIT="48e622ba74bc35c5a81299d3a34b9b14038d6a70"
+
+DESCRIPTION="C-Reduce - a plugin-based C program reducer"
+HOMEPAGE="https://embed.cs.utah.edu/creduce/";
+SRC_URI="https://github.com/csmith-project/${PN}/archive/${EGIT_COMMIT}.tar.gz 
-> ${PN}-${EGIT_COMMIT}.tar.gz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+LLVM_MAX_SLOT=7
+
+COMMON_DEPEND="
+       >=dev-lang/perl-5.10.0
+       sys-devel/clang:${LLVM_MAX_SLOT}"
+RDEPEND="${COMMON_DEPEND}
+       dev-perl/Benchmark-Timer
+       dev-perl/Exporter-Lite
+       dev-perl/File-Which
+       dev-perl/Getopt-Tabular
+       dev-perl/Regexp-Common
+       dev-perl/Sys-CPU
+       dev-util/astyle
+       dev-util/indent"
+DEPEND="${COMMON_DEPEND}"
+
+S="${WORKDIR}/${PN}-${EGIT_COMMIT}"
+
+PATCHES=(
+       "${FILESDIR}"/creduce-llvm-7.patch
+)
+
+llvm_check_deps() {
+       has_version "sys-devel/clang:${LLVM_SLOT}"
+}

diff --git a/dev-util/creduce/files/creduce-llvm-7.patch 
b/dev-util/creduce/files/creduce-llvm-7.patch
new file mode 100644
index 00000000000..a005eebff2e
--- /dev/null
+++ b/dev-util/creduce/files/creduce-llvm-7.patch
@@ -0,0 +1,90 @@
+From c0d9c3a2ef763eb09f0a70b8ad86250598549487 Mon Sep 17 00:00:00 2001
+From: Yang Chen <[email protected]>
+Date: Fri, 28 Sep 2018 00:39:22 -0700
+Subject: [PATCH] building with LLVM 7.0
+
+cope with some API changes for LLVM 7.0
+---
+ clang_delta/ExpressionDetector.cpp     | 20 +++++++++++---------
+ clang_delta/RemoveUnusedEnumMember.cpp |  8 ++++----
+ clang_delta/TransformationManager.cpp  |  2 +-
+ 3 files changed, 16 insertions(+), 14 deletions(-)
+
+diff --git a/clang_delta/ExpressionDetector.cpp 
b/clang_delta/ExpressionDetector.cpp
+index aa87873..dd77068 100644
+--- a/clang_delta/ExpressionDetector.cpp
++++ b/clang_delta/ExpressionDetector.cpp
+@@ -64,7 +64,8 @@ public:
+                           StringRef FileName, bool IsAngled,
+                           CharSourceRange FilenameRange, const FileEntry 
*File,
+                           StringRef SearchPath, StringRef RelativePath,
+-                          const Module *Imported) override;
++                          const Module *Imported,
++                          SrcMgr::CharacteristicKind FileType) override;
+ 
+ private:
+   SourceManager &SrcManager;
+@@ -77,14 +78,15 @@ private:
+ };
+ 
+ void IncludesPPCallbacks::InclusionDirective(SourceLocation HashLoc,
+-                                            const Token &/*IncludeTok*/,
+-                                            StringRef FileName,
+-                                            bool /*IsAngled*/,
+-                                            CharSourceRange /*FilenameRange*/,
+-                                            const FileEntry * /*File*/,
+-                                            StringRef /*SearchPath*/,
+-                                            StringRef /*RelativePath*/,
+-                                            const Module * /*Imported*/)
++                                        const Token &/*IncludeTok*/,
++                                        StringRef FileName,
++                                        bool /*IsAngled*/,
++                                        CharSourceRange /*FilenameRange*/,
++                                        const FileEntry * /*File*/,
++                                        StringRef /*SearchPath*/,
++                                        StringRef /*RelativePath*/,
++                                        const Module * /*Imported*/,
++                                        SrcMgr::CharacteristicKind 
/*FileType*/)
+ {
+   if (!SrcManager.isInMainFile(HashLoc))
+     return;
+diff --git a/clang_delta/RemoveUnusedEnumMember.cpp 
b/clang_delta/RemoveUnusedEnumMember.cpp
+index 8bf8673..469db3f 100644
+--- a/clang_delta/RemoveUnusedEnumMember.cpp
++++ b/clang_delta/RemoveUnusedEnumMember.cpp
+@@ -99,15 +99,15 @@ void RemoveUnusedEnumMember::removeEnumConstantDecl()
+ {
+   SourceLocation StartLoc = (*TheEnumIterator)->getLocStart();
+   if (StartLoc.isMacroID()) {
+-    std::pair<SourceLocation, SourceLocation> Locs =
++    CharSourceRange CSRange =
+       SrcManager->getExpansionRange(StartLoc);
+-    StartLoc = Locs.first;
++    StartLoc = CSRange.getBegin();
+   }
+   SourceLocation EndLoc = (*TheEnumIterator)->getLocEnd();
+   if (EndLoc.isMacroID()) {
+-    std::pair<SourceLocation, SourceLocation> Locs =
++    CharSourceRange CSRange =
+       SrcManager->getExpansionRange(EndLoc);
+-    EndLoc = Locs.second;
++    EndLoc = CSRange.getEnd();
+   }
+   SourceLocation CommaLoc = Lexer::findLocationAfterToken(
+     EndLoc, tok::comma, *SrcManager, Context->getLangOpts(),
+diff --git a/clang_delta/TransformationManager.cpp 
b/clang_delta/TransformationManager.cpp
+index 89e9d72..1e56b90 100644
+--- a/clang_delta/TransformationManager.cpp
++++ b/clang_delta/TransformationManager.cpp
+@@ -223,7 +223,7 @@ llvm::raw_ostream *TransformationManager::getOutStream()
+ 
+   std::error_code EC;
+   llvm::raw_fd_ostream *Out = new llvm::raw_fd_ostream(
+-      OutputFileName, EC, llvm::sys::fs::F_RW);
++      OutputFileName, EC, llvm::sys::fs::FA_Read | llvm::sys::fs::FA_Write);
+   assert(!EC && "Cannot open output file!");
+   return Out;
+ }
+-- 
+2.19.0
+

Reply via email to