diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-22 01:49:17 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-22 02:45:59 +0200 |
commit | c428bb604472b3d18095628bc9b04583a167322a (patch) | |
tree | b6cecfcfd833e2697f44068f560ee53538a0306c | |
parent | a28524eedcd543a5659324a49e3e024101f834bc (diff) | |
download | aports-c428bb604472b3d18095628bc9b04583a167322a.tar.bz2 aports-c428bb604472b3d18095628bc9b04583a167322a.tar.xz |
testing/creduce: rebuild against llvm/clang 4.0.0
-rw-r--r-- | testing/creduce/APKBUILD | 17 | ||||
-rw-r--r-- | testing/creduce/fix-crash-due-to-overwriting-same-location.patch | 118 | ||||
-rw-r--r-- | testing/creduce/namespace-qualify-clang-StringLiteral.patch | 29 |
3 files changed, 157 insertions, 7 deletions
diff --git a/testing/creduce/APKBUILD b/testing/creduce/APKBUILD index 37bef7bad3..5eccf8f75b 100644 --- a/testing/creduce/APKBUILD +++ b/testing/creduce/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Jakub Jirutka <jakub@jirutka.cz> pkgname=creduce pkgver=2.6.0 -pkgrel=0 +pkgrel=1 pkgdesc="A C/C++ program reducer" url="http://embed.cs.utah.edu/creduce/" arch="all" @@ -11,19 +11,20 @@ license="custom" depends="clang indent perl perl-exporter-lite perl-file-which perl-getopt-tabular perl-regexp-common perl-sys-cpu perl-term-readkey util-linux" -makedepends="clang-dev>=3.8.0 flex llvm-dev>=3.8.0 zlib-dev" -source="http://embed.cs.utah.edu/creduce/$pkgname-$pkgver.tar.gz" +makedepends="clang-dev clang-static flex llvm-dev zlib-dev" +source="http://embed.cs.utah.edu/creduce/$pkgname-$pkgver.tar.gz + namespace-qualify-clang-StringLiteral.patch + fix-crash-due-to-overwriting-same-location.patch" builddir="$srcdir/$pkgname-$pkgver" build() { cd "$builddir" - ./configure \ + CC=clang CXX=clang++ ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ - --libexecdir=/usr/lib/$pkgname \ - || return 1 + --libexecdir=/usr/lib/$pkgname make } @@ -32,4 +33,6 @@ package() { make DESTDIR="$pkgdir" install } -sha512sums="e2a08127d2aea29b6934792eff4ff0d9f10952ca520671c60ef4b24a48522b19c48336d4b9d0b8e8c633dd8832b2a56d3d0daa311478e474e974c60a0ae381f1 creduce-2.6.0.tar.gz" +sha512sums="e2a08127d2aea29b6934792eff4ff0d9f10952ca520671c60ef4b24a48522b19c48336d4b9d0b8e8c633dd8832b2a56d3d0daa311478e474e974c60a0ae381f1 creduce-2.6.0.tar.gz +34b0a4f77b4e6c51130771faf653189822bcd53335db24dfa0d5f772315cd5c84c24ef2977fb1a2bc431b611cce4efb5c5e6e3d217e6181433a701ffa0ac4d11 namespace-qualify-clang-StringLiteral.patch +02c87a4efaf31e937dea6e0a84ca4e4d3e0cedc1a013db0f0eea929d0e28afd44e5c65f16087f94f7f41222ba7d2f69ce0e4e1c4a51461f71b18130c563444df fix-crash-due-to-overwriting-same-location.patch" diff --git a/testing/creduce/fix-crash-due-to-overwriting-same-location.patch b/testing/creduce/fix-crash-due-to-overwriting-same-location.patch new file mode 100644 index 0000000000..25d7baa8d1 --- /dev/null +++ b/testing/creduce/fix-crash-due-to-overwriting-same-location.patch @@ -0,0 +1,118 @@ +From 30c2d8e3a6505ed6699216833441eccaeedf02ad Mon Sep 17 00:00:00 2001 +From: Yang Chen <chenyang@cs.utah.edu> +Date: Sat, 14 Jan 2017 02:08:05 -0800 +Subject: [PATCH] Fixed a crash due to overwriting the same location + +In some cases (most likely for ill-declared templates), +we may rewrite the same location multiple times, and +hence trigger an ICE. This is now fixed. + +Upstream-Commit: https://github.com/csmith-project/creduce/commit/30c2d8e3a6505ed6699216833441eccaeedf02ad +--- + clang_delta/RemoveUnusedFunction.cpp | 23 ++++++++++++++++++++++- + clang_delta/RemoveUnusedFunction.h | 7 ++++++- + 2 files changed, 28 insertions(+), 2 deletions(-) + +diff --git a/clang_delta/RemoveUnusedFunction.cpp b/clang_delta/RemoveUnusedFunction.cpp +index f9be26f..b38fe51 100644 +--- a/clang_delta/RemoveUnusedFunction.cpp ++++ b/clang_delta/RemoveUnusedFunction.cpp +@@ -388,6 +388,8 @@ SourceLocation RemoveUnusedFunction::getFunctionOuterLocStart( + const FunctionDecl *FD) + { + SourceLocation LocStart = FD->getLocStart(); ++ bool RecordLoc = false; ++ + // check if FD is from a function template + if (FunctionTemplateDecl *FTD = FD->getDescribedFunctionTemplate()) { + // get FTD->getLocStart() only if it is less than FD->getLocStart, +@@ -396,8 +398,10 @@ SourceLocation RemoveUnusedFunction::getFunctionOuterLocStart( + // template<typename T> template<typename T1> void S<T>::foo() { } + // where + // FTD->getLocStart() points to the begining of "template<typename T1>" +- if (hasValidOuterLocStart(FTD, FD)) ++ if (hasValidOuterLocStart(FTD, FD)) { + LocStart = FTD->getLocStart(); ++ RecordLoc = true; ++ } + } + + if (LocStart.isMacroID()) +@@ -406,6 +410,17 @@ SourceLocation RemoveUnusedFunction::getFunctionOuterLocStart( + // this is ugly, but how do we get the location of __extension__? e.g.: + // __extension__ void foo(); + LocStart = getExtensionLocStart(LocStart); ++ ++ // In some cases where the given input is not well-formed, we may ++ // end up with duplicate locations for the FunctionTemplateDecl ++ // case. In such cases, we simply return an invalid SourceLocation, ++ // which will ben skipped by the caller of getFunctionOuterLocStart. ++ if (RecordLoc) { ++ if (VisitedLocations.count(LocStart)) ++ return SourceLocation(); ++ VisitedLocations.insert(LocStart); ++ } ++ + return LocStart; + } + +@@ -468,6 +483,8 @@ void RemoveUnusedFunction::removeOneFunctionDecl(const FunctionDecl *FD) + LocEnd = SrcManager->getExpansionLoc(LocEnd); + if (!FD->isInExternCContext() && !FD->isInExternCXXContext()) { + SourceLocation FuncLocStart = getFunctionOuterLocStart(FD); ++ if (FuncLocStart.isInvalid()) ++ return; + LocEnd = getFunctionLocEnd(FuncLocStart, LocEnd, FD); + if (SrcManager->isWrittenInMainFile(FuncLocStart) && + SrcManager->isWrittenInMainFile(LocEnd)) +@@ -479,6 +496,8 @@ void RemoveUnusedFunction::removeOneFunctionDecl(const FunctionDecl *FD) + const LinkageSpecDecl *Linkage = dyn_cast<LinkageSpecDecl>(Ctx); + if (!Linkage) { + SourceLocation FuncLocStart = getFunctionOuterLocStart(FD); ++ if (FuncLocStart.isInvalid()) ++ return; + LocEnd = getFunctionLocEnd(FuncLocStart, LocEnd, FD); + TheRewriter.RemoveText(SourceRange(FuncLocStart, LocEnd)); + return; +@@ -488,6 +507,8 @@ void RemoveUnusedFunction::removeOneFunctionDecl(const FunctionDecl *FD) + // namespace { using ::foo; } + if (Linkage->hasBraces()) { + SourceLocation FuncLocStart = getFunctionOuterLocStart(FD); ++ if (FuncLocStart.isInvalid()) ++ return; + TheRewriter.RemoveText(SourceRange(FuncLocStart, LocEnd)); + return; + } +diff --git a/clang_delta/RemoveUnusedFunction.h b/clang_delta/RemoveUnusedFunction.h +index d724aeb..ded12d7 100644 +--- a/clang_delta/RemoveUnusedFunction.h ++++ b/clang_delta/RemoveUnusedFunction.h +@@ -14,8 +14,9 @@ + #include <string> + #include <map> + #include <set> +-#include "llvm/ADT/SmallPtrSet.h" + #include "llvm/ADT/DenseMap.h" ++#include "llvm/ADT/SmallPtrSet.h" ++#include "llvm/ADT/SmallSet.h" + #include "Transformation.h" + #include "clang/Basic/SourceLocation.h" + +@@ -98,6 +99,8 @@ friend class ExtraReferenceVisitorWrapper; + + typedef std::set<std::string> SystemFunctionsSet; + ++ typedef llvm::SmallSet<clang::SourceLocation, 5> LocSet; ++ + virtual void Initialize(clang::ASTContext &context); + + virtual void HandleTranslationUnit(clang::ASTContext &Ctx); +@@ -188,6 +191,8 @@ friend class ExtraReferenceVisitorWrapper; + + SystemFunctionsSet ExistingSystemFunctions; + ++ LocSet VisitedLocations; ++ + FunctionDeclVector AllValidFunctionDecls; + + RUFAnalysisVisitor *AnalysisVisitor; diff --git a/testing/creduce/namespace-qualify-clang-StringLiteral.patch b/testing/creduce/namespace-qualify-clang-StringLiteral.patch new file mode 100644 index 0000000000..85acd0a02f --- /dev/null +++ b/testing/creduce/namespace-qualify-clang-StringLiteral.patch @@ -0,0 +1,29 @@ +From ba1b8a60672a29a82f2e5df79f05c94d088552c1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Mon, 19 Dec 2016 09:54:10 +0100 +Subject: [PATCH] clang_delta: Namespace-qualify clang::StringLiteral + +Use clang::StringLiteral rather than relying on the using statement +since llvm::StringLiteral was introduced lately and made plain +'StringLiteral' ambiguous. + +Upstream-Commit: https://github.com/csmith-project/creduce/commit/ba1b8a60672a29a82f2e5df79f05c94d088552c1 +--- + clang_delta/ExpressionDetector.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/clang_delta/ExpressionDetector.cpp b/clang_delta/ExpressionDetector.cpp +index f84153d..be519eb 100644 +--- a/clang_delta/ExpressionDetector.cpp ++++ b/clang_delta/ExpressionDetector.cpp +@@ -452,8 +452,8 @@ bool ExpressionDetector::isIdenticalExpr(const Expr *E1, const Expr *E2) + } + + case Stmt::StringLiteralClass: { +- const StringLiteral *Lit1 = cast<StringLiteral>(E1); +- const StringLiteral *Lit2 = cast<StringLiteral>(E2); ++ const clang::StringLiteral *Lit1 = cast<clang::StringLiteral>(E1); ++ const clang::StringLiteral *Lit2 = cast<clang::StringLiteral>(E2); + return Lit1->getBytes() == Lit2->getBytes(); + } + |