testing/creduce: upgrade to 2.7.0

upgrade and remove patches merged upstream
This commit is contained in:
Roberto Oliveira 2017-07-29 01:12:56 +00:00 committed by Shiz
parent 49c14af4c4
commit b6d4060bc7
3 changed files with 4 additions and 155 deletions

View File

@ -1,8 +1,8 @@
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=creduce
pkgver=2.6.0
pkgrel=1
pkgver=2.7.0
pkgrel=0
pkgdesc="A C/C++ program reducer"
url="http://embed.cs.utah.edu/creduce/"
arch="all !x86"
@ -12,9 +12,7 @@ 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 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"
source="http://embed.cs.utah.edu/creduce/$pkgname-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"
build() {
@ -33,6 +31,4 @@ package() {
make DESTDIR="$pkgdir" install
}
sha512sums="e2a08127d2aea29b6934792eff4ff0d9f10952ca520671c60ef4b24a48522b19c48336d4b9d0b8e8c633dd8832b2a56d3d0daa311478e474e974c60a0ae381f1 creduce-2.6.0.tar.gz
34b0a4f77b4e6c51130771faf653189822bcd53335db24dfa0d5f772315cd5c84c24ef2977fb1a2bc431b611cce4efb5c5e6e3d217e6181433a701ffa0ac4d11 namespace-qualify-clang-StringLiteral.patch
02c87a4efaf31e937dea6e0a84ca4e4d3e0cedc1a013db0f0eea929d0e28afd44e5c65f16087f94f7f41222ba7d2f69ce0e4e1c4a51461f71b18130c563444df fix-crash-due-to-overwriting-same-location.patch"
sha512sums="0ded47fdb4303d84619d63fbedd7bc12141b4857679dda8438683199dbdc98b985f848e797b9dc25a31dda591ee54bcb94580285890b23495fcf151aa3636226 creduce-2.7.0.tar.gz"

View File

@ -1,118 +0,0 @@
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;

View File

@ -1,29 +0,0 @@
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();
}