$ git show --format=fuller --patch-with-stat --summary 7a5020a7a7f8a8cbd3933c1bb5679a25cfd1726a
commit 7a5020a7a7f8a8cbd3933c1bb5679a25cfd1726a
Author: Bernhard Rosenkraenzer <bero@lindev.ch>
AuthorDate: Mon Sep 23 12:04:12 2019 +0200
Commit: Bernhard Rosenkraenzer <bero@lindev.ch>
CommitDate: Mon Sep 23 12:04:12 2019 +0200
2.10.0
---
.abf.yml | 2 +-
0001-Fixes-140-Support-version-flag.patch | 43 --
0002-Increment-version-number-to-2.9.0.patch | 140 ----
0003-Fix-option-name.patch | 41 --
0004-Handle-DependentScopeDeclRefExpr.patch | 56 --
...a-CXXRecordDecl-only-if-it-has-definition.patch | 26 -
...number-of-CPUs-only-if-n-wasn-t-specified.patch | 33 -
0007-Fix-typo.patch | 25 -
0008-Handle-non-constant-array-types.patch | 108 ---
...Fixed-an-issue-for-rewriting-record-decls.patch | 385 ----------
0010-Allow-tests-with-.cc-postfix.patch | 25 -
0011-Added-a-new-test.patch | 42 --
0012-Fixed-issues-for-empty-struct-to-int.patch | 111 ---
...ritting-destructors-when-renaming-classes.patch | 50 --
0014-Fixed-an-issue-for-empty-struct-to-int.patch | 27 -
0015-Use-a-different-name-for-the-sub-loop.patch | 39 -
0016-make-InclusionDirective-virtual.patch | 26 -
0017-Fixed-a-Wreturn-type-warning.patch | 24 -
...crash-for-removing-explicit-instantiation.patch | 27 -
...ing-nested-calls-from-member-initializers.patch | 49 --
0020-Update-RemoveUnusedEnumMember.h.patch | 28 -
0021-Update-include-guard.patch | 28 -
...take-syntactic-form-only-if-it-s-non-null.patch | 44 --
0023-built-with-LLVM-7.0.patch | 90 ---
...ring-so-pass_includes-is-called-after-pas.patch | 34 -
0025-add-pass-to-remove-constant-ifs.patch | 45 --
0026-add-pass-for-line-markers.patch | 186 -----
...binary-search-removal-of-c-style-comments.patch | 176 -----
0028-convert-to-markdown.patch | 395 -----------
...tch-from-Mingwandroid-to-update-to-LLVM-7.patch | 182 -----
...-skip-inlining-calls-in-default-arguments.patch | 37 -
...-llvm-svn-compatible-branch-for-ToT-clang.patch | 784 ---------------------
creduce.spec | 38 +-
33 files changed, 4 insertions(+), 3342 deletions(-)
delete mode 100644 0001-Fixes-140-Support-version-flag.patch
delete mode 100644 0002-Increment-version-number-to-2.9.0.patch
delete mode 100644 0003-Fix-option-name.patch
delete mode 100644 0004-Handle-DependentScopeDeclRefExpr.patch
delete mode 100644 0005-Iterate-a-CXXRecordDecl-only-if-it-has-definition.patch
delete mode 100644 0006-Check-number-of-CPUs-only-if-n-wasn-t-specified.patch
delete mode 100644 0007-Fix-typo.patch
delete mode 100644 0008-Handle-non-constant-array-types.patch
delete mode 100644 0009-Fixed-an-issue-for-rewriting-record-decls.patch
delete mode 100644 0010-Allow-tests-with-.cc-postfix.patch
delete mode 100644 0011-Added-a-new-test.patch
delete mode 100644 0012-Fixed-issues-for-empty-struct-to-int.patch
delete mode 100644 0013-avoid-overwritting-destructors-when-renaming-classes.patch
delete mode 100644 0014-Fixed-an-issue-for-empty-struct-to-int.patch
delete mode 100644 0015-Use-a-different-name-for-the-sub-loop.patch
delete mode 100644 0016-make-InclusionDirective-virtual.patch
delete mode 100644 0017-Fixed-a-Wreturn-type-warning.patch
delete mode 100644 0018-Fixed-a-crash-for-removing-explicit-instantiation.patch
delete mode 100644 0019-avoid-removing-nested-calls-from-member-initializers.patch
delete mode 100644 0020-Update-RemoveUnusedEnumMember.h.patch
delete mode 100644 0021-Update-include-guard.patch
delete mode 100644 0022-take-syntactic-form-only-if-it-s-non-null.patch
delete mode 100644 0023-built-with-LLVM-7.0.patch
delete mode 100644 0024-change-ordering-so-pass_includes-is-called-after-pas.patch
delete mode 100644 0025-add-pass-to-remove-constant-ifs.patch
delete mode 100644 0026-add-pass-for-line-markers.patch
delete mode 100644 0027-add-binary-search-removal-of-c-style-comments.patch
delete mode 100644 0028-convert-to-markdown.patch
delete mode 100644 0029-patch-from-Mingwandroid-to-update-to-LLVM-7.patch
delete mode 100644 0030-skip-inlining-calls-in-default-arguments.patch
delete mode 100644 0031-Update-llvm-svn-compatible-branch-for-ToT-clang.patch
diff --git a/.abf.yml b/.abf.yml
index 88f9293..8060f84 100644
--- a/.abf.yml
+++ b/.abf.yml
@@ -1,2 +1,2 @@
sources:
- creduce-2.8.0.tar.gz: 66b82459490b063c51bcf74cdd895cc81a2a7e61
+ creduce-2.10.0.tar.gz: 77c3dafb2446133ca2f2aeae34b2e4b79de5231d
diff --git a/0001-Fixes-140-Support-version-flag.patch b/0001-Fixes-140-Support-version-flag.patch
deleted file mode 100644
index 56c5ca8..0000000
--- a/0001-Fixes-140-Support-version-flag.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 15bc038e316013bef5ad08e30cddd52cd3f846f6 Mon Sep 17 00:00:00 2001
-From: Pranav Kant <pranav913@gmail.com>
-Date: Sun, 18 Mar 2018 23:49:15 +0530
-Subject: [PATCH 01/31] Fixes #140: Support --version flag
-
----
- creduce/creduce.in | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/creduce/creduce.in b/creduce/creduce.in
-index f7597ee..07f55c8 100644
---- a/creduce/creduce.in
-+++ b/creduce/creduce.in
-@@ -69,8 +69,16 @@ my $NOKILL = 0;
- my $MAX_WIN;
- my $NO_CACHE = 0;
- my $NOTC = 0;
-+my $PKG = creduce_config::PACKAGE_STRING;
-+my $COMMIT = creduce_config::GIT_VERSION;
-+
-+sub print_version() {
-+ print "$PKG ($COMMIT)\n";
-+ exit(0);
-+}
-
- my @options = (
-+ ["--version", "call", 0, \&print_version, "Print the version information"] ,
- ["--n", "integer", 1, \$NPROCS, "Number of cores to use; C-Reduce tries to automatically pick a good setting but its choice may be too low or high for your situation", "<N>"],
- ["--tidy", "const", 1, \$TIDY, "Do not make a backup copy of each file to reduce as file.orig"],
- ["--shaddap", "const", 1, \$SILENT_PASS_BUGS, "Suppress output about non-fatal internal errors"],
-@@ -95,9 +103,6 @@ my @options = (
- );
-
- @options = sort { return @{$a}[0] cmp @{$b}[0]; } @options;
--
--my $PKG = creduce_config::PACKAGE_STRING;
--my $COMMIT = creduce_config::GIT_VERSION;
- my $help = <<HELP;
- $PKG ($COMMIT) -- a C and C++ program reducer
-
---
-2.21.0
-
diff --git a/0002-Increment-version-number-to-2.9.0.patch b/0002-Increment-version-number-to-2.9.0.patch
deleted file mode 100644
index 41859f9..0000000
--- a/0002-Increment-version-number-to-2.9.0.patch
+++ /dev/null
@@ -1,140 +0,0 @@
-From 30a225ef20e9b31807fd04cffd3d2d1606ee32de Mon Sep 17 00:00:00 2001
-From: Eric Eide <eeide@cs.utah.edu>
-Date: Fri, 6 Jul 2018 15:57:04 -0600
-Subject: [PATCH 02/31] Increment version number to 2.9.0.
-
----
- CMakeLists.txt | 6 +++---
- configure | 20 ++++++++++----------
- version.m4 | 4 ++--
- 3 files changed, 15 insertions(+), 15 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index dc50e2d..7ccda15 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -90,11 +90,11 @@ check_include_file("unistd.h" HAVE_UNISTD_H)
- set(creduce_PACKAGE "creduce")
- set(creduce_PACKAGE_BUGREPORT "creduce-bugs@flux.utah.edu")
- set(creduce_PACKAGE_NAME "creduce")
--set(creduce_PACKAGE_STRING "creduce 2.8.0")
-+set(creduce_PACKAGE_STRING "creduce 2.9.0")
- set(creduce_PACKAGE_TARNAME "creduce")
- set(creduce_PACKAGE_URL "http://embed.cs.utah.edu/creduce/")
--set(creduce_PACKAGE_VERSION "2.8.0")
--set(creduce_VERSION "2.8.0")
-+set(creduce_PACKAGE_VERSION "2.9.0")
-+set(creduce_VERSION "2.9.0")
-
- # FIXME: Should be determined automatically.
- set(YYTEXT_POINTER 1)
-diff --git a/configure b/configure
-index 9209583..8887357 100755
---- a/configure
-+++ b/configure
-@@ -1,6 +1,6 @@
- #! /bin/sh
- # Guess values for system-dependent variables and create Makefiles.
--# Generated by GNU Autoconf 2.69 for creduce 2.8.0.
-+# Generated by GNU Autoconf 2.69 for creduce 2.9.0.
- #
- # Report bugs to <creduce-bugs@flux.utah.edu>.
- #
-@@ -590,8 +590,8 @@ MAKEFLAGS=
- # Identity of this package.
- PACKAGE_NAME='creduce'
- PACKAGE_TARNAME='creduce'
--PACKAGE_VERSION='2.8.0'
--PACKAGE_STRING='creduce 2.8.0'
-+PACKAGE_VERSION='2.9.0'
-+PACKAGE_STRING='creduce 2.9.0'
- PACKAGE_BUGREPORT='creduce-bugs@flux.utah.edu'
- PACKAGE_URL='http://embed.cs.utah.edu/creduce/'
-
-@@ -1347,7 +1347,7 @@ if test "$ac_init_help" = "long"; then
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat <<_ACEOF
--\`configure' configures creduce 2.8.0 to adapt to many kinds of systems.
-+\`configure' configures creduce 2.9.0 to adapt to many kinds of systems.
-
- Usage: $0 [OPTION]... [VAR=VALUE]...
-
-@@ -1418,7 +1418,7 @@ fi
-
- if test -n "$ac_init_help"; then
- case $ac_init_help in
-- short | recursive ) echo "Configuration of creduce 2.8.0:";;
-+ short | recursive ) echo "Configuration of creduce 2.9.0:";;
- esac
- cat <<\_ACEOF
-
-@@ -1544,7 +1544,7 @@ fi
- test -n "$ac_init_help" && exit $ac_status
- if $ac_init_version; then
- cat <<\_ACEOF
--creduce configure 2.8.0
-+creduce configure 2.9.0
- generated by GNU Autoconf 2.69
-
- Copyright (C) 2012 Free Software Foundation, Inc.
-@@ -1943,7 +1943,7 @@ cat >config.log <<_ACEOF
- This file contains any messages produced by compilers while
- running configure, to aid debugging if configure makes a mistake.
-
--It was created by creduce $as_me 2.8.0, which was
-+It was created by creduce $as_me 2.9.0, which was
- generated by GNU Autoconf 2.69. Invocation command line was
-
- $ $0 $@
-@@ -2924,7 +2924,7 @@ fi
-
- # Define the identity of the package.
- PACKAGE='creduce'
-- VERSION='2.8.0'
-+ VERSION='2.9.0'
-
-
- cat >>confdefs.h <<_ACEOF
-@@ -17162,7 +17162,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
- # report actual input values of CONFIG_FILES etc. instead of their
- # values after options handling.
- ac_log="
--This file was extended by creduce $as_me 2.8.0, which was
-+This file was extended by creduce $as_me 2.9.0, which was
- generated by GNU Autoconf 2.69. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
-@@ -17229,7 +17229,7 @@ _ACEOF
- cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
- ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
- ac_cs_version="\\
--creduce config.status 2.8.0
-+creduce config.status 2.9.0
- configured by $0, generated by GNU Autoconf 2.69,
- with options \\"\$ac_cs_config\\"
-
-diff --git a/version.m4 b/version.m4
-index 65230a9..2e15d99 100644
---- a/version.m4
-+++ b/version.m4
-@@ -1,6 +1,6 @@
- ## -*- mode: m4 -*-
- ##
--## Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 The University of Utah
-+## Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018 The University of Utah
- ## All rights reserved.
- ##
- ## This file is distributed under the University of Illinois Open Source
-@@ -8,7 +8,7 @@
-
- ###############################################################################
-
--m4_define([CREDUCE_VERSION], [2.8.0])
-+m4_define([CREDUCE_VERSION], [2.9.0])
- m4_define([CREDUCE_BUGREPORT], [creduce-bugs@flux.utah.edu])
- m4_define([CREDUCE_URL], [http://embed.cs.utah.edu/creduce/])
-
---
-2.21.0
-
diff --git a/0003-Fix-option-name.patch b/0003-Fix-option-name.patch
deleted file mode 100644
index 2faa30b..0000000
--- a/0003-Fix-option-name.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From e8b42cde454a91bc4ad17339f652794d35019be5 Mon Sep 17 00:00:00 2001
-From: Jakub Wilk <jwilk@jwilk.net>
-Date: Mon, 16 Jul 2018 13:21:48 +0200
-Subject: [PATCH 03/31] Fix option name
-
-"-n" was renamed as "--n" in e5c6db7cd95459b1271f9027c31ee4706da063b6,
-but documentation and comments weren't updated.
----
- README | 2 +-
- creduce/creduce_utils.pm | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/README b/README
-index 672adee..492b6f5 100644
---- a/README
-+++ b/README
-@@ -38,7 +38,7 @@ compiler leaves files in /tmp when it is killed, C-Reduce has no way
- to discover and remove the files. You will need to do this manually
- from time to time if temporary file space is limited. The leakage is
- typically pretty slow. If you need to avoid this problem altogether,
--you can run C-Reduce on a single core (using "-n 1") in which case
-+you can run C-Reduce on a single core (using "--n 1") in which case
- C-Reduce will never kill a running compiler instance. Alternatively, a
- command line option such as -pipe (supported by gcc) may suppress the
- creation of temporary files altogether. Another possibility is to set
-diff --git a/creduce/creduce_utils.pm b/creduce/creduce_utils.pm
-index d468f17..eeb7cc3 100644
---- a/creduce/creduce_utils.pm
-+++ b/creduce/creduce_utils.pm
-@@ -129,7 +129,7 @@ sub ncpus () {
-
- # here we're pretty conservative about the number of parallel
- # processes to use; if the user has some big iron she can specify a
--# higher number using -n
-+# higher number using --n
- sub nprocs () {
- my $cpus = ncpus();
- die unless ($cpus >= 1);
---
-2.21.0
-
diff --git a/0004-Handle-DependentScopeDeclRefExpr.patch b/0004-Handle-DependentScopeDeclRefExpr.patch
deleted file mode 100644
index 0b30ec3..0000000
--- a/0004-Handle-DependentScopeDeclRefExpr.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 193a981a44e2bc119724c7937f4b04bdcdcc70ff Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Wed, 8 Aug 2018 22:53:52 -0700
-Subject: [PATCH 04/31] Handle DependentScopeDeclRefExpr
-
-make an auto-type tmp variable for a DependentScopeDeclRefExpr
----
- clang_delta/RemoveNestedFunction.cpp | 11 +++++++++++
- clang_delta/RemoveNestedFunction.h | 2 ++
- 2 files changed, 13 insertions(+)
-
-diff --git a/clang_delta/RemoveNestedFunction.cpp b/clang_delta/RemoveNestedFunction.cpp
-index 60ae7b2..7666207 100644
---- a/clang_delta/RemoveNestedFunction.cpp
-+++ b/clang_delta/RemoveNestedFunction.cpp
-@@ -215,6 +215,11 @@ void RemoveNestedFunction::getNewIntTmpVariable(std::string &VarStr)
- VarStr = "int " + VarStr;
- }
-
-+void RemoveNestedFunction::getNewAutoTmpVariable(std::string &VarStr)
-+{
-+ VarStr = "auto " + VarStr;
-+}
-+
- void RemoveNestedFunction::addNewTmpVariable(ASTContext &ASTCtx)
- {
- std::string VarStr;
-@@ -437,6 +442,12 @@ void RemoveNestedFunction::getNewTmpVariableStr(ASTContext &ASTCtx,
- }
- }
-
-+ // We can't resolve dependent scoped DeclRefExpr, and just make it
-+ // type of int.
-+ if (dyn_cast<DependentScopeDeclRefExpr>(E)) {
-+ return getNewAutoTmpVariable(VarStr);
-+ }
-+
- const Type *CalleeType = E->getType().getTypePtr();
- // template <class T1, class T2> struct S {
- // T1 x; T2 y;
-diff --git a/clang_delta/RemoveNestedFunction.h b/clang_delta/RemoveNestedFunction.h
-index 1d6c28e..231689a 100644
---- a/clang_delta/RemoveNestedFunction.h
-+++ b/clang_delta/RemoveNestedFunction.h
-@@ -81,6 +81,8 @@ private:
-
- void getNewIntTmpVariable(std::string &VarStr);
-
-+ void getNewAutoTmpVariable(std::string &VarStr);
-+
- clang::SmallVector<clang::CallExpr *, 5> CallExprQueue;
-
- clang::SmallVector<clang::CallExpr *, 10> ValidCallExprs;
---
-2.21.0
-
diff --git a/0005-Iterate-a-CXXRecordDecl-only-if-it-has-definition.patch b/0005-Iterate-a-CXXRecordDecl-only-if-it-has-definition.patch
deleted file mode 100644
index 17260d4..0000000
--- a/0005-Iterate-a-CXXRecordDecl-only-if-it-has-definition.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From b49e8ccac86360ee5c2c085d20ffdb9e88c7b4f8 Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Thu, 9 Aug 2018 23:55:31 -0700
-Subject: [PATCH 05/31] Iterate a CXXRecordDecl only if it has definition
-
----
- clang_delta/Transformation.cpp | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/clang_delta/Transformation.cpp b/clang_delta/Transformation.cpp
-index a9d3b5e..29a7c33 100644
---- a/clang_delta/Transformation.cpp
-+++ b/clang_delta/Transformation.cpp
-@@ -510,6 +510,9 @@ const FunctionDecl *Transformation::lookupFunctionDeclFromBases(
- const CXXRecordDecl *CXXRD,
- DeclContextSet &VisitedCtxs)
- {
-+ if (!CXXRD->hasDefinition()) {
-+ return NULL;
-+ }
- for (CXXRecordDecl::base_class_const_iterator I =
- CXXRD->bases_begin(), E = CXXRD->bases_end(); I != E; ++I) {
-
---
-2.21.0
-
diff --git a/0006-Check-number-of-CPUs-only-if-n-wasn-t-specified.patch b/0006-Check-number-of-CPUs-only-if-n-wasn-t-specified.patch
deleted file mode 100644
index e2a7708..0000000
--- a/0006-Check-number-of-CPUs-only-if-n-wasn-t-specified.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 0a4413089d7088f50ed8bbde74473aaedd284722 Mon Sep 17 00:00:00 2001
-From: Jakub Wilk <jwilk@jwilk.net>
-Date: Wed, 22 Aug 2018 10:29:48 +0000
-Subject: [PATCH 06/31] Check number of CPUs only if --n wasn't specified
-
----
- creduce/creduce.in | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/creduce/creduce.in b/creduce/creduce.in
-index 07f55c8..1586f93 100644
---- a/creduce/creduce.in
-+++ b/creduce/creduce.in
-@@ -45,7 +45,7 @@ if ($^O eq "MSWin32") {
- use creduce_config qw(PACKAGE_STRING);
- use creduce_utils;
-
--my $NPROCS = nprocs();
-+my $NPROCS;
-
- ######################################################################
-
-@@ -208,6 +208,7 @@ Getopt::Tabular::SetOptionPatterns qw|(--)([\w-]+) (-)(\w+)|;
- Getopt::Tabular::SetHelpOption("--help");
- GetOptions(\@options, \@ARGV) or exit(1);
- usage() unless (@ARGV >= 2);
-+defined $NPROCS or $NPROCS = nprocs();
-
- my @custom_methods;
-
---
-2.21.0
-
diff --git a/0007-Fix-typo.patch b/0007-Fix-typo.patch
deleted file mode 100644
index 9831c78..0000000
--- a/0007-Fix-typo.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 78e434bb72f749a002dadb0390163210e63250e6 Mon Sep 17 00:00:00 2001
-From: Jakub Wilk <jwilk@jwilk.net>
-Date: Wed, 22 Aug 2018 12:34:02 +0200
-Subject: [PATCH 07/31] Fix typo
-
----
- creduce/creduce.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/creduce/creduce.in b/creduce/creduce.in
-index 07f55c8..c134cbb 100644
---- a/creduce/creduce.in
-+++ b/creduce/creduce.in
-@@ -134,7 +134,7 @@ timeout is that when a test is killed due to timing out, a message
- will be printed. If you do implement a timeout yourself, we recommend
- that your interestingness test returns exit code 124 when a subcommand
- times out. This will not affect the reduction but it will cause
--C-Reduce to print a message stating the the interestingness test
-+C-Reduce to print a message stating the interestingness test
- reported a timeout. It is important to ensure that timeouts are not
- occurring too often (especially during C-Reduce's initial passes) or
- else C-Reduce will work poorly.
---
-2.21.0
-
diff --git a/0008-Handle-non-constant-array-types.patch b/0008-Handle-non-constant-array-types.patch
deleted file mode 100644
index 727ac1f..0000000
--- a/0008-Handle-non-constant-array-types.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 921324f8c7eec1ec94f329e4e3e7a492dee90b2f Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Fri, 24 Aug 2018 01:00:51 -0700
-Subject: [PATCH 08/31] Handle non-constant-array types
-
----
- clang_delta/ReduceArrayDim.cpp | 29 ++++++++++++++-----
- clang_delta/ReduceArrayDim.h | 3 ++
- .../reduce-array-dim/non-type-temp-arg.cpp | 11 +++++++
- 3 files changed, 35 insertions(+), 8 deletions(-)
- create mode 100644 clang_delta/tests/reduce-array-dim/non-type-temp-arg.cpp
-
-diff --git a/clang_delta/ReduceArrayDim.cpp b/clang_delta/ReduceArrayDim.cpp
-index dfc185a..a2f8e40 100644
---- a/clang_delta/ReduceArrayDim.cpp
-+++ b/clang_delta/ReduceArrayDim.cpp
-@@ -239,6 +239,25 @@ void ReduceArrayDim::rewriteInitListExpr(const InitListExpr *ILE,
- }
- }
-
-+unsigned ReduceArrayDim::getArraySize(const ArrayType *ATy)
-+{
-+ if (const ConstantArrayType *CstArrayTy =
-+ dyn_cast<ConstantArrayType>(ATy)) {
-+ return getConstArraySize(CstArrayTy);
-+ }
-+
-+ if (const DependentSizedArrayType *DepArrayTy =
-+ dyn_cast<DependentSizedArrayType>(ATy)) {
-+ const Expr *E = DepArrayTy->getSizeExpr();
-+ llvm::APSInt Result;
-+ if (E->EvaluateAsInt(Result, *Context)) {
-+ return (unsigned)(*Result.getRawData());
-+ }
-+ }
-+
-+ return 1;
-+}
-+
- void ReduceArrayDim::rewriteOneVarDecl(const VarDecl *VD)
- {
- const Type *Ty = VD->getType().getTypePtr();
-@@ -259,9 +278,7 @@ void ReduceArrayDim::rewriteOneVarDecl(const VarDecl *VD)
- TransAssert((BPVector.size() > 1) && "Invalid Bracket Pairs!");
-
- ArraySubTypeVector::const_reverse_iterator TyIdx = TyVec.rbegin();
-- const ConstantArrayType *CstArrayTy = dyn_cast<ConstantArrayType>(*TyIdx);
-- TransAssert(CstArrayTy && "Non ConstantArrayType!");
-- unsigned LastSz = getConstArraySize(CstArrayTy);
-+ unsigned LastSz = getArraySize(*TyIdx);
-
- ++TyIdx;
- const ArrayType *SecArrayTy = (*TyIdx);
-@@ -275,12 +292,8 @@ void ReduceArrayDim::rewriteOneVarDecl(const VarDecl *VD)
- BracketLocPair *SecBracketPair = (*BIdx);
- // We keep incomplete array
- if (!dyn_cast<IncompleteArrayType>(SecArrayTy)) {
-- const ConstantArrayType *SecCstArrayTy =
-- dyn_cast<ConstantArrayType>(SecArrayTy);
-- TransAssert(SecCstArrayTy && "Non ConstantArrayType!");
--
- // Keep this value, which is needed for rewriting ArraySubscriptExpr
-- ArraySz = getConstArraySize(SecCstArrayTy);
-+ ArraySz = getArraySize(SecArrayTy);
-
- std::stringstream TmpSS;
- TmpSS << (LastSz * ArraySz);
-diff --git a/clang_delta/ReduceArrayDim.h b/clang_delta/ReduceArrayDim.h
-index 0a5ff7c..efd859c 100644
---- a/clang_delta/ReduceArrayDim.h
-+++ b/clang_delta/ReduceArrayDim.h
-@@ -21,6 +21,7 @@ namespace clang {
- class ASTContext;
- class VarDecl;
- class ArraySubscriptExpr;
-+ class ArrayType;
- }
-
- class ReduceArrayDimCollectionVisitor;
-@@ -83,6 +84,8 @@ private:
- void rewriteInitListExpr(const clang::InitListExpr *ILE,
- unsigned int Dim);
-
-+ unsigned getArraySize(const clang::ArrayType *ATy);
-+
- VarDeclSet VisitedVarDecls;
-
- ReduceArrayDimCollectionVisitor *CollectionVisitor;
-diff --git a/clang_delta/tests/reduce-array-dim/non-type-temp-arg.cpp b/clang_delta/tests/reduce-array-dim/non-type-temp-arg.cpp
-new file mode 100644
-index 0000000..ed2cced
---- /dev/null
-+++ b/clang_delta/tests/reduce-array-dim/non-type-temp-arg.cpp
-@@ -0,0 +1,11 @@
-+// RUN: %clang_delta --transformation=reduce-array-dim --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+template <int h>
-+void foo() {
-+// CHECK: double k[1];
-+ double k[1][h];
-+// CHECK-NEXT: }
-+}
-+void bar() {
-+ foo<1>();
-+}
---
-2.21.0
-
diff --git a/0009-Fixed-an-issue-for-rewriting-record-decls.patch b/0009-Fixed-an-issue-for-rewriting-record-decls.patch
deleted file mode 100644
index 67cf4a7..0000000
--- a/0009-Fixed-an-issue-for-rewriting-record-decls.patch
+++ /dev/null
@@ -1,385 +0,0 @@
-From d5bb977c4669eca50ac1c897e75f8f8b3a01ee07 Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Mon, 27 Aug 2018 22:38:15 -0700
-Subject: [PATCH 09/31] Fixed an issue for rewriting record decls
-
-When we have a record decl through its definition, we can only
-rewrite its definition once.
----
- clang_delta/CommonRenameClassRewriteVisitor.h | 48 ++++++++++++++-----
- clang_delta/RemoveBaseClass.cpp | 15 +++---
- clang_delta/RenameClass.cpp | 9 ++--
- clang_delta/ReplaceDerivedClass.cpp | 11 +++--
- clang_delta/RewriteUtils.cpp | 15 ++++++
- clang_delta/RewriteUtils.h | 3 ++
- clang_delta/Transformation.cpp | 11 +++++
- clang_delta/Transformation.h | 11 +++++
- .../replace-derived1.cpp | 15 ++++++
- .../replace-derived2.cpp | 16 +++++++
- .../replace-derived3.cpp | 16 +++++++
- 11 files changed, 142 insertions(+), 28 deletions(-)
- create mode 100644 clang_delta/tests/replace-derived-class/replace-derived1.cpp
- create mode 100644 clang_delta/tests/replace-derived-class/replace-derived2.cpp
- create mode 100644 clang_delta/tests/replace-derived-class/replace-derived3.cpp
-
-diff --git a/clang_delta/CommonRenameClassRewriteVisitor.h b/clang_delta/CommonRenameClassRewriteVisitor.h
-index 61bdd80..ff755a8 100644
---- a/clang_delta/CommonRenameClassRewriteVisitor.h
-+++ b/clang_delta/CommonRenameClassRewriteVisitor.h
-@@ -14,6 +14,8 @@
- #include "llvm/ADT/SmallPtrSet.h"
- #include "clang/AST/RecursiveASTVisitor.h"
-
-+class Transformation;
-+
- namespace clang_delta_common_visitor {
-
- using namespace clang;
-@@ -21,11 +23,13 @@ using namespace clang;
- template<typename T>
- class CommonRenameClassRewriteVisitor : public RecursiveASTVisitor<T> {
- public:
-- CommonRenameClassRewriteVisitor(Rewriter *RT,
-+ CommonRenameClassRewriteVisitor(Transformation *Instance,
-+ Rewriter *RT,
- RewriteUtils *Helper,
- const CXXRecordDecl *CXXRD,
- const std::string &Name)
-- : TheRewriter(RT),
-+ : ConsumerInstance(Instance),
-+ TheRewriter(RT),
- RewriteHelper(Helper),
- TheCXXRecordDecl(CXXRD),
- NewNameStr(Name)
-@@ -74,6 +78,8 @@ private:
-
- LocPtrSet VisitedLocs;
-
-+ Transformation *ConsumerInstance;
-+
- Rewriter *TheRewriter;
-
- RewriteUtils *RewriteHelper;
-@@ -177,7 +183,18 @@ bool CommonRenameClassRewriteVisitor<T>::VisitCXXRecordDecl(
- CXXRecordDecl *CXXRD)
- {
- std::string Name;
-- if (getNewName(CXXRD, Name)) {
-+ if (!getNewName(CXXRD, Name))
-+ return true;
-+
-+ void *LocPtr = CXXRD->getLocation().getPtrEncoding();
-+ if (VisitedLocs.count(LocPtr))
-+ return true;
-+ VisitedLocs.insert(LocPtr);
-+
-+ if (ConsumerInstance->isDeclaringRecordDecl(CXXRD)) {
-+ RewriteHelper->replaceRecordDeclDef(CXXRD, Name);
-+ }
-+ else {
- RewriteHelper->replaceRecordDeclName(CXXRD, Name);
- }
-
-@@ -279,16 +296,21 @@ bool CommonRenameClassRewriteVisitor<T>::VisitRecordTypeLoc(RecordTypeLoc RTLoc)
- return true;
-
- std::string Name;
-- if (getNewName(RD, Name)) {
-- // Avoid duplicated rewrites to Decls from the same DeclGroup, e.g.,
-- // struct S s1, s2
-- SourceLocation LocStart = RTLoc.getLocStart();
-- void *LocPtr = LocStart.getPtrEncoding();
-- if (VisitedLocs.count(LocPtr))
-- return true;
-- VisitedLocs.insert(LocPtr);
-- RewriteHelper->replaceRecordType(RTLoc, Name);
-- }
-+ if (!getNewName(RD, Name))
-+ return true;
-+
-+ // Let VisitCXXRecordDecl handle this case.
-+ if (ConsumerInstance->isDeclaringRecordDecl(RD))
-+ return true;
-+
-+ // Avoid duplicated rewrites to Decls from the same DeclGroup, e.g.,
-+ // struct S s1, s2
-+ SourceLocation LocStart = RTLoc.getLocStart();
-+ void *LocPtr = LocStart.getPtrEncoding();
-+ if (VisitedLocs.count(LocPtr))
-+ return true;
-+ VisitedLocs.insert(LocPtr);
-+ RewriteHelper->replaceRecordType(RTLoc, Name);
- return true;
- }
-
-diff --git a/clang_delta/RemoveBaseClass.cpp b/clang_delta/RemoveBaseClass.cpp
-index 2c04943..1cf0c8d 100644
---- a/clang_delta/RemoveBaseClass.cpp
-+++ b/clang_delta/RemoveBaseClass.cpp
-@@ -60,16 +60,17 @@ bool RemoveBaseClassBaseVisitor::VisitCXXRecordDecl(
- return true;
- }
-
--class RemoveBaseClassRewriteVisitor : public
-+class RemoveBaseClassRewriteVisitor : public
- CommonRenameClassRewriteVisitor<RemoveBaseClassRewriteVisitor>
- {
- public:
-- RemoveBaseClassRewriteVisitor(Rewriter *RT,
-- RewriteUtils *Helper,
-- const CXXRecordDecl *CXXRD,
-- const std::string &Name)
-+ RemoveBaseClassRewriteVisitor(Transformation *Instance,
-+ Rewriter *RT,
-+ RewriteUtils *Helper,
-+ const CXXRecordDecl *CXXRD,
-+ const std::string &Name)
- : CommonRenameClassRewriteVisitor<RemoveBaseClassRewriteVisitor>
-- (RT, Helper, CXXRD, Name)
-+ (Instance, RT, Helper, CXXRD, Name)
- { }
- };
-
-@@ -102,7 +103,7 @@ void RemoveBaseClass::HandleTranslationUnit(ASTContext &Ctx)
- Ctx.getDiagnostics().setSuppressAllDiagnostics(false);
-
- RewriteVisitor =
-- new RemoveBaseClassRewriteVisitor(&TheRewriter, RewriteHelper,
-+ new RemoveBaseClassRewriteVisitor(this, &TheRewriter, RewriteHelper,
- TheBaseClass->getCanonicalDecl(),
- TheDerivedClass->getNameAsString());
-
-diff --git a/clang_delta/RenameClass.cpp b/clang_delta/RenameClass.cpp
-index 8a316ce..3cb463f 100644
---- a/clang_delta/RenameClass.cpp
-+++ b/clang_delta/RenameClass.cpp
-@@ -51,15 +51,16 @@ private:
- };
-
- class RenameClassRewriteVisitor : public
-- CommonRenameClassRewriteVisitor<RenameClassRewriteVisitor>
-+ CommonRenameClassRewriteVisitor<RenameClassRewriteVisitor>
- {
- public:
-- RenameClassRewriteVisitor(Rewriter *RT,
-+ RenameClassRewriteVisitor(Transformation *Instance,
-+ Rewriter *RT,
- RewriteUtils *Helper,
- const CXXRecordDecl *CXXRD,
- const std::string &Name)
- : CommonRenameClassRewriteVisitor<RenameClassRewriteVisitor>
-- (RT, Helper, CXXRD, Name)
-+ (Instance, RT, Helper, CXXRD, Name)
- { }
- };
-
-@@ -101,7 +102,7 @@ void RenameClass::HandleTranslationUnit(ASTContext &Ctx)
- Ctx.getDiagnostics().setSuppressAllDiagnostics(false);
-
- RewriteVisitor =
-- new RenameClassRewriteVisitor(&TheRewriter, RewriteHelper,
-+ new RenameClassRewriteVisitor(this, &TheRewriter, RewriteHelper,
- TheCXXRecordDecl, NewNameStr);
-
- TransAssert(RewriteVisitor && "NULL RewriteVisitor!");
-diff --git a/clang_delta/ReplaceDerivedClass.cpp b/clang_delta/ReplaceDerivedClass.cpp
-index 9d865c0..11d3376 100644
---- a/clang_delta/ReplaceDerivedClass.cpp
-+++ b/clang_delta/ReplaceDerivedClass.cpp
-@@ -49,12 +49,13 @@ class ReplaceDerivedClassRewriteVisitor : public
- CommonRenameClassRewriteVisitor<ReplaceDerivedClassRewriteVisitor>
- {
- public:
-- ReplaceDerivedClassRewriteVisitor(Rewriter *RT,
-+ ReplaceDerivedClassRewriteVisitor(Transformation *Instance,
-+ Rewriter *RT,
- RewriteUtils *Helper,
- const CXXRecordDecl *CXXRD,
- const std::string &Name)
- : CommonRenameClassRewriteVisitor<ReplaceDerivedClassRewriteVisitor>
-- (RT, Helper, CXXRD, Name)
-+ (Instance, RT, Helper, CXXRD, Name)
- { }
- };
-
-@@ -93,7 +94,7 @@ void ReplaceDerivedClass::HandleTranslationUnit(ASTContext &Ctx)
- Ctx.getDiagnostics().setSuppressAllDiagnostics(false);
-
- RewriteVisitor =
-- new ReplaceDerivedClassRewriteVisitor(&TheRewriter, RewriteHelper,
-+ new ReplaceDerivedClassRewriteVisitor(this, &TheRewriter, RewriteHelper,
- TheDerivedClass->getCanonicalDecl(),
- TheBaseClass->getNameAsString());
- TransAssert(RewriteVisitor && "NULL RewriteVisitor!");
-@@ -177,7 +178,9 @@ void ReplaceDerivedClass::doRewrite(void)
- RewriteHelper->removeClassTemplateDecls(TmplD);
- }
- else {
-- RewriteHelper->removeClassDecls(TheDerivedClass);
-+ if (!isDeclaringRecordDecl(TheDerivedClass)) {
-+ RewriteHelper->removeClassDecls(TheDerivedClass);
-+ }
- }
- }
-
-diff --git a/clang_delta/RewriteUtils.cpp b/clang_delta/RewriteUtils.cpp
-index 129f184..895cf89 100644
---- a/clang_delta/RewriteUtils.cpp
-+++ b/clang_delta/RewriteUtils.cpp
-@@ -1026,6 +1026,21 @@ bool RewriteUtils::replaceRecordDeclName(const RecordDecl *RD,
- NameStr);
- }
-
-+bool RewriteUtils::replaceRecordDeclDef(const RecordDecl *RD,
-+ const std::string &NameStr)
-+{
-+ if (RD->isThisDeclarationADefinition()) {
-+ SourceLocation RBLoc = RD->getBraceRange().getEnd();
-+ if (RBLoc.isInvalid()) {
-+ return !TheRewriter->ReplaceText(RD->getSourceRange(), NameStr);
-+ }
-+ else {
-+ SourceLocation StartLoc = RD->getSourceRange().getBegin();
-+ return !TheRewriter->ReplaceText(SourceRange(StartLoc, RBLoc), NameStr);
-+ }
-+ }
-+}
-+
- bool RewriteUtils::replaceVarTypeName(const VarDecl *VD,
- const std::string &NameStr)
- {
-diff --git a/clang_delta/RewriteUtils.h b/clang_delta/RewriteUtils.h
-index 05e212e..986349a 100644
---- a/clang_delta/RewriteUtils.h
-+++ b/clang_delta/RewriteUtils.h
-@@ -127,6 +127,9 @@ public:
- bool replaceRecordDeclName(const clang::RecordDecl *RD,
- const std::string &NameStr);
-
-+ bool replaceRecordDeclDef(const clang::RecordDecl *RD,
-+ const std::string &NameStr);
-+
- bool replaceVarTypeName(const clang::VarDecl *VD,
- const std::string &NameStr);
-
-diff --git a/clang_delta/Transformation.cpp b/clang_delta/Transformation.cpp
-index 29a7c33..9fa9cb1 100644
---- a/clang_delta/Transformation.cpp
-+++ b/clang_delta/Transformation.cpp
-@@ -1076,6 +1076,17 @@ bool Transformation::isInIncludedFile(const Stmt *S) const
- return isInIncludedFile(S->getLocStart());
- }
-
-+bool Transformation::isDeclaringRecordDecl(const RecordDecl *RD)
-+{
-+ SourceLocation SemiLoc =
-+ Lexer::findLocationAfterToken(RD->getSourceRange().getEnd(),
-+ tok::semi,
-+ *SrcManager,
-+ Context->getLangOpts(),
-+ /*SkipTrailingWhitespaceAndNewLine=*/true);
-+ return SemiLoc.isInvalid();
-+}
-+
- Transformation::~Transformation(void)
- {
- RewriteUtils::Finalize();
-diff --git a/clang_delta/Transformation.h b/clang_delta/Transformation.h
-index 55d692b..c1aff47 100644
---- a/clang_delta/Transformation.h
-+++ b/clang_delta/Transformation.h
-@@ -57,8 +57,17 @@ typedef enum {
- TransToCounterTooBigError
- } TransformationError;
-
-+namespace clang_delta_common_visitor {
-+
-+template<typename T> class CommonRenameClassRewriteVisitor;
-+
-+}
-+
- class Transformation : public clang::ASTConsumer {
-
-+template<typename T>
-+friend class clang_delta_common_visitor::CommonRenameClassRewriteVisitor;
-+
- public:
-
- Transformation(const char *TransName, const char *Desc)
-@@ -290,6 +299,8 @@ protected:
-
- bool isInIncludedFile(const clang::Stmt *S) const;
-
-+ bool isDeclaringRecordDecl(const clang::RecordDecl *RD);
-+
- const std::string Name;
-
- int TransformationCounter;
-diff --git a/clang_delta/tests/replace-derived-class/replace-derived1.cpp b/clang_delta/tests/replace-derived-class/replace-derived1.cpp
-new file mode 100644
-index 0000000..b20cff2
---- /dev/null
-+++ b/clang_delta/tests/replace-derived-class/replace-derived1.cpp
-@@ -0,0 +1,15 @@
-+// RUN: %clang_delta --transformation=replace-derived-class --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+struct a {
-+ ~a();
-+};
-+// CHECK-NOT: struct X
-+struct X : a {};
-+// CHECK: foo() {
-+void foo() {
-+// CHECK-NEXT: a *b;
-+ X *b;
-+// CHECK-NEXT: b->~a();
-+ b->~X();
-+// CHECK-NEXT: }
-+}
-diff --git a/clang_delta/tests/replace-derived-class/replace-derived2.cpp b/clang_delta/tests/replace-derived-class/replace-derived2.cpp
-new file mode 100644
-index 0000000..7311ba7
---- /dev/null
-+++ b/clang_delta/tests/replace-derived-class/replace-derived2.cpp
-@@ -0,0 +1,16 @@
-+// RUN: %clang_delta --transformation=replace-derived-class --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+// CHECK: struct a {
-+struct a {
-+// CHECK-NEXT: ~a();
-+ ~a();
-+// CHECK-NEXT: };
-+};
-+// CHECK-NEXT: a *b;
-+struct X : a {} *b;
-+// CHECK-NEXT: void foo() {
-+void foo() {
-+// CHECK-NEXT: b->~a();
-+ b->~X();
-+// CHECK-NEXT: }
-+}
-diff --git a/clang_delta/tests/replace-derived-class/replace-derived3.cpp b/clang_delta/tests/replace-derived-class/replace-derived3.cpp
-new file mode 100644
-index 0000000..f6756af
---- /dev/null
-+++ b/clang_delta/tests/replace-derived-class/replace-derived3.cpp
-@@ -0,0 +1,16 @@
-+// RUN: %clang_delta --transformation=replace-derived-class --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+// CHECK: struct a {
-+struct a {
-+// CHECK-NEXT: ~a();
-+ ~a();
-+// CHECK-NEXT: };
-+};
-+// CHECK-NEXT: a *b;
-+struct abcabcabcabcabcabcabca : a {} *b;
-+// CHECK-NEXT: void foo() {
-+void foo() {
-+// CHECK-NEXT: b->~a();
-+ b->~abcabcabcabcabcabcabca();
-+// CHECK-NEXT: }
-+}
---
-2.21.0
-
diff --git a/0010-Allow-tests-with-.cc-postfix.patch b/0010-Allow-tests-with-.cc-postfix.patch
deleted file mode 100644
index 41a587c..0000000
--- a/0010-Allow-tests-with-.cc-postfix.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From f0312d47bdc6ba9b1fb989832d8c8bc69c5b0fec Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Mon, 27 Aug 2018 22:53:15 -0700
-Subject: [PATCH 10/31] Allow tests with .cc postfix
-
----
- clang_delta/tests/lit.cfg | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/clang_delta/tests/lit.cfg b/clang_delta/tests/lit.cfg
-index 0db613f..215258a 100644
---- a/clang_delta/tests/lit.cfg
-+++ b/clang_delta/tests/lit.cfg
-@@ -13,7 +13,7 @@ import os
- import sys
-
- config.name = 'clang_delta'
--config.suffixes = ['.c', '.cpp']
-+config.suffixes = ['.c', '.cc', '.cpp']
- config.test_exec_root = config.builddir + '/tests'
- config.test_format = lit.formats.ShTest()
- config.test_source_root = os.path.dirname(__file__)
---
-2.21.0
-
diff --git a/0011-Added-a-new-test.patch b/0011-Added-a-new-test.patch
deleted file mode 100644
index b46f9d2..0000000
--- a/0011-Added-a-new-test.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From e64bc7cefc626744ce4cc828887bb7de67162865 Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Mon, 27 Aug 2018 23:05:00 -0700
-Subject: [PATCH 11/31] Added a new test
-
----
- .../tests/rename-class/rename-class1.cpp | 23 +++++++++++++++++++
- 1 file changed, 23 insertions(+)
- create mode 100644 clang_delta/tests/rename-class/rename-class1.cpp
-
-diff --git a/clang_delta/tests/rename-class/rename-class1.cpp b/clang_delta/tests/rename-class/rename-class1.cpp
-new file mode 100644
-index 0000000..f045710
---- /dev/null
-+++ b/clang_delta/tests/rename-class/rename-class1.cpp
-@@ -0,0 +1,23 @@
-+// RUN: %clang_delta --transformation=rename-class --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+// CHECK: class A {
-+class AAA {
-+// CHECK-NEXT: public:
-+public:
-+// CHECK-NEXT: A() {}
-+ AAA() {}
-+// CHECK-NEXT: static int m1;
-+ static int m1;
-+// CHECK-NEXT: };
-+};
-+// CHECK-NEXT: int A::m1;
-+int AAA::m1;
-+// CHECK-NEXT: void foo() {
-+void foo() {
-+// CHECK-NEXT: A a1;
-+ AAA a1;
-+// CHECK-NEXT: A::m1 = 1;
-+ AAA::m1 = 1;
-+// CHECK-NEXT: }
-+}
-+
---
-2.21.0
-
diff --git a/0012-Fixed-issues-for-empty-struct-to-int.patch b/0012-Fixed-issues-for-empty-struct-to-int.patch
deleted file mode 100644
index 4b507f5..0000000
--- a/0012-Fixed-issues-for-empty-struct-to-int.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From c168920bd55b906db293d06528853ab77db97015 Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Tue, 28 Aug 2018 00:17:39 -0700
-Subject: [PATCH 12/31] Fixed issues for empty-struct-to-int
-
----
- clang_delta/EmptyStructToInt.cpp | 6 ++++++
- clang_delta/tests/empty-struct-to-int/empty-struct.cpp | 8 ++++++++
- .../tests/empty-struct-to-int/empty-struct2.cpp | 9 +++++++++
- .../tests/empty-struct-to-int/empty-struct3.cpp | 9 +++++++++
- .../tests/empty-struct-to-int/empty-struct4.cpp | 6 ++++++
- .../tests/empty-struct-to-int/empty-struct5.cpp | 10 ++++++++++
- 6 files changed, 48 insertions(+)
- create mode 100644 clang_delta/tests/empty-struct-to-int/empty-struct.cpp
- create mode 100644 clang_delta/tests/empty-struct-to-int/empty-struct2.cpp
- create mode 100644 clang_delta/tests/empty-struct-to-int/empty-struct3.cpp
- create mode 100644 clang_delta/tests/empty-struct-to-int/empty-struct4.cpp
- create mode 100644 clang_delta/tests/empty-struct-to-int/empty-struct5.cpp
-
-diff --git a/clang_delta/EmptyStructToInt.cpp b/clang_delta/EmptyStructToInt.cpp
-index dbffd82..29615af 100644
---- a/clang_delta/EmptyStructToInt.cpp
-+++ b/clang_delta/EmptyStructToInt.cpp
-@@ -443,6 +443,12 @@ bool EmptyStructToInt::isValidRecordDecl(const RecordDecl *RD)
- if (!(*I)->isImplicit()) {
- if ((*I)->isReferenced())
- return false;
-+ if (isa<CXXConstructorDecl>(*I) || isa<CXXDestructorDecl>(*I))
-+ return false;
-+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(*I)) {
-+ if (FD->hasBody() && !FD->isInlined())
-+ return false;
-+ }
- ++count;
- }
- }
-diff --git a/clang_delta/tests/empty-struct-to-int/empty-struct.cpp b/clang_delta/tests/empty-struct-to-int/empty-struct.cpp
-new file mode 100644
-index 0000000..a39adf2
---- /dev/null
-+++ b/clang_delta/tests/empty-struct-to-int/empty-struct.cpp
-@@ -0,0 +1,8 @@
-+// RUN: %clang_delta --transformation=empty-struct-to-int --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+// CHECK-NOT: struct S
-+struct S {
-+ void foo();
-+};
-+// CHECK: int s;
-+S s;
-diff --git a/clang_delta/tests/empty-struct-to-int/empty-struct2.cpp b/clang_delta/tests/empty-struct-to-int/empty-struct2.cpp
-new file mode 100644
-index 0000000..25e8340
---- /dev/null
-+++ b/clang_delta/tests/empty-struct-to-int/empty-struct2.cpp
-@@ -0,0 +1,9 @@
-+// RUN: %clang_delta --transformation=empty-struct-to-int --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+// CHECK: struct S1
-+struct S1 {
-+// CHECK: int S;
-+ struct {} S;
-+// CHECK-NEXT: struct S *s1;
-+ struct S *s1;
-+};
-diff --git a/clang_delta/tests/empty-struct-to-int/empty-struct3.cpp b/clang_delta/tests/empty-struct-to-int/empty-struct3.cpp
-new file mode 100644
-index 0000000..9e6f016
---- /dev/null
-+++ b/clang_delta/tests/empty-struct-to-int/empty-struct3.cpp
-@@ -0,0 +1,9 @@
-+// RUN: %clang_delta --transformation=empty-struct-to-int --counter=2 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+// CHECK: struct S1
-+struct S1 {
-+// CHECK: struct {} S;
-+ struct {} S;
-+// CHECK-NEXT: int *s1;
-+ struct S *s1;
-+};
-diff --git a/clang_delta/tests/empty-struct-to-int/empty-struct4.cpp b/clang_delta/tests/empty-struct-to-int/empty-struct4.cpp
-new file mode 100644
-index 0000000..fbf6237
---- /dev/null
-+++ b/clang_delta/tests/empty-struct-to-int/empty-struct4.cpp
-@@ -0,0 +1,6 @@
-+// RUN: %clang_delta --transformation=empty-struct-to-int --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+// CHECK: int g, i;
-+struct S {} g, i;
-+// CHECK: int s;
-+S s;
-diff --git a/clang_delta/tests/empty-struct-to-int/empty-struct5.cpp b/clang_delta/tests/empty-struct-to-int/empty-struct5.cpp
-new file mode 100644
-index 0000000..ccb1a3b
---- /dev/null
-+++ b/clang_delta/tests/empty-struct-to-int/empty-struct5.cpp
-@@ -0,0 +1,10 @@
-+// RUN: %clang_delta --transformation=empty-struct-to-int --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+// CHECK-NOT: struct S2
-+struct S2 {
-+// CHECK-NOT: int a[2]
-+ char a[2];
-+// CHECK-NOT: };
-+};
-+// CHECK: int s
-+S2 s = {{1,2}};
---
-2.21.0
-
diff --git a/0013-avoid-overwritting-destructors-when-renaming-classes.patch b/0013-avoid-overwritting-destructors-when-renaming-classes.patch
deleted file mode 100644
index 4b96e59..0000000
--- a/0013-avoid-overwritting-destructors-when-renaming-classes.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From daee960a14d739c4124c7ea7adccfad4c69f5966 Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Tue, 28 Aug 2018 00:41:09 -0700
-Subject: [PATCH 13/31] avoid overwritting destructors when renaming classes
-
----
- clang_delta/CommonRenameClassRewriteVisitor.h | 8 ++++++++
- clang_delta/tests/rename-class/rename-class2.cpp | 11 +++++++++++
- 2 files changed, 19 insertions(+)
- create mode 100644 clang_delta/tests/rename-class/rename-class2.cpp
-
-diff --git a/clang_delta/CommonRenameClassRewriteVisitor.h b/clang_delta/CommonRenameClassRewriteVisitor.h
-index ff755a8..725b8c9 100644
---- a/clang_delta/CommonRenameClassRewriteVisitor.h
-+++ b/clang_delta/CommonRenameClassRewriteVisitor.h
-@@ -242,6 +242,14 @@ bool CommonRenameClassRewriteVisitor<T>::VisitCXXDestructorDecl(
- return true;
- }
-
-+ SourceLocation StartLoc = DtorDecl->getLocation();
-+ // skip '~'
-+ StartLoc = StartLoc.getLocWithOffset(1);
-+ void *LocPtr = StartLoc.getPtrEncoding();
-+ if (VisitedLocs.count(LocPtr))
-+ return true;
-+ VisitedLocs.insert(LocPtr);
-+
- std::string Name;
- if (getNewName(CXXRD, Name)) {
- RewriteHelper->replaceCXXDestructorDeclName(DtorDecl, Name);
-diff --git a/clang_delta/tests/rename-class/rename-class2.cpp b/clang_delta/tests/rename-class/rename-class2.cpp
-new file mode 100644
-index 0000000..499dd4f
---- /dev/null
-+++ b/clang_delta/tests/rename-class/rename-class2.cpp
-@@ -0,0 +1,11 @@
-+// RUN: %clang_delta --transformation=rename-class --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+// CHECK: struct A {
-+struct ababababababababab {
-+// CHECK-NEXT: ~A();
-+ ~ababababababababab();
-+// CHECK-NEXT: };
-+};
-+// CHECK-NEXT: A::~A() {}
-+ababababababababab::~ababababababababab() {}
-+
---
-2.21.0
-
diff --git a/0014-Fixed-an-issue-for-empty-struct-to-int.patch b/0014-Fixed-an-issue-for-empty-struct-to-int.patch
deleted file mode 100644
index 6995daa..0000000
--- a/0014-Fixed-an-issue-for-empty-struct-to-int.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 9aa30eb7a804a39d04311a07c8b0e807fe542fa1 Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Tue, 28 Aug 2018 00:42:41 -0700
-Subject: [PATCH 14/31] Fixed an issue for empty-struct-to-int
-
----
- clang_delta/EmptyStructToInt.cpp | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/clang_delta/EmptyStructToInt.cpp b/clang_delta/EmptyStructToInt.cpp
-index 29615af..ae15c8a 100644
---- a/clang_delta/EmptyStructToInt.cpp
-+++ b/clang_delta/EmptyStructToInt.cpp
-@@ -449,6 +449,10 @@ bool EmptyStructToInt::isValidRecordDecl(const RecordDecl *RD)
- if (FD->hasBody() && !FD->isInlined())
- return false;
- }
-+ if (const FieldDecl *FieldD = dyn_cast<FieldDecl>(*I)) {
-+ if (pointToSelf(FieldD))
-+ return false;
-+ }
- ++count;
- }
- }
---
-2.21.0
-
diff --git a/0015-Use-a-different-name-for-the-sub-loop.patch b/0015-Use-a-different-name-for-the-sub-loop.patch
deleted file mode 100644
index 6cee3d1..0000000
--- a/0015-Use-a-different-name-for-the-sub-loop.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 873ade2b6cce4f68f35633bd052e586193d5b4ca Mon Sep 17 00:00:00 2001
-From: 360 CodeSafe <39950310+360CodeSafe@users.noreply.github.com>
-Date: Thu, 20 Sep 2018 17:16:10 +0800
-Subject: [PATCH 15/31] Use a different name for the sub loop
-
-Since variable 'I' is already used as the iterator in for in line 108, in line 123, it is better to use another variable as the counter for the for loop.
----
- clang_delta/ReduceArraySize.cpp | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/clang_delta/ReduceArraySize.cpp b/clang_delta/ReduceArraySize.cpp
-index d96ed0c..e86fd73 100644
---- a/clang_delta/ReduceArraySize.cpp
-+++ b/clang_delta/ReduceArraySize.cpp
-@@ -120,9 +120,9 @@ void ReduceArraySize::doAnalysis(void)
- unsigned int DimSz = DimVec->size();
- TransAssert((DimSz == OrigDimVec->size()) &&
- "Two DimValueVectors should have the same size!");
-- for (unsigned int I = 0; I < DimSz; ++I) {
-- int DimV = (*DimVec)[I];
-- int OrigDimV = (*OrigDimVec)[I];
-+ for (unsigned int II = 0; II < DimSz; ++II) {
-+ int DimV = (*DimVec)[II];
-+ int OrigDimV = (*OrigDimVec)[II];
- if ((DimV == -1) || (OrigDimV == 0) || ((DimV+1) == OrigDimV))
- continue;
-
-@@ -132,7 +132,7 @@ void ReduceArraySize::doAnalysis(void)
-
- TheVarDecl = VD;
- TheDimValue = DimV;
-- TheDimIdx = I;
-+ TheDimIdx = II;
- }
- }
- }
---
-2.21.0
-
diff --git a/0016-make-InclusionDirective-virtual.patch b/0016-make-InclusionDirective-virtual.patch
deleted file mode 100644
index c427b7b..0000000
--- a/0016-make-InclusionDirective-virtual.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 99129c114e562ea7d4e9ce57a3f576bdc48630bc Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Mon, 24 Sep 2018 22:19:52 -0700
-Subject: [PATCH 16/31] make InclusionDirective virtual
-
----
- clang_delta/ExpressionDetector.cpp | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/clang_delta/ExpressionDetector.cpp b/clang_delta/ExpressionDetector.cpp
-index e0c9fc5..aa87873 100644
---- a/clang_delta/ExpressionDetector.cpp
-+++ b/clang_delta/ExpressionDetector.cpp
-@@ -59,7 +59,8 @@ public:
- : SrcManager(M), HeaderName(Name), HasHeader(H), HeaderLoc(Loc)
- { }
-
-- void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
-+ virtual void InclusionDirective(SourceLocation HashLoc,
-+ const Token &IncludeTok,
- StringRef FileName, bool IsAngled,
- CharSourceRange FilenameRange, const FileEntry *File,
- StringRef SearchPath, StringRef RelativePath,
---
-2.21.0
-
diff --git a/0017-Fixed-a-Wreturn-type-warning.patch b/0017-Fixed-a-Wreturn-type-warning.patch
deleted file mode 100644
index f0e5a4a..0000000
--- a/0017-Fixed-a-Wreturn-type-warning.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 8fc6028e654fd75b048c05190a9e326a6af22b2d Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Mon, 1 Oct 2018 20:35:53 -0700
-Subject: [PATCH 17/31] Fixed a -Wreturn-type warning
-
----
- clang_delta/RewriteUtils.cpp | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/clang_delta/RewriteUtils.cpp b/clang_delta/RewriteUtils.cpp
-index 895cf89..1adde91 100644
---- a/clang_delta/RewriteUtils.cpp
-+++ b/clang_delta/RewriteUtils.cpp
-@@ -1039,6 +1039,7 @@ bool RewriteUtils::replaceRecordDeclDef(const RecordDecl *RD,
- return !TheRewriter->ReplaceText(SourceRange(StartLoc, RBLoc), NameStr);
- }
- }
-+ return true;
- }
-
- bool RewriteUtils::replaceVarTypeName(const VarDecl *VD,
---
-2.21.0
-
diff --git a/0018-Fixed-a-crash-for-removing-explicit-instantiation.patch b/0018-Fixed-a-crash-for-removing-explicit-instantiation.patch
deleted file mode 100644
index 7afd22a..0000000
--- a/0018-Fixed-a-crash-for-removing-explicit-instantiation.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From a841921192e820d440bd51e65a1b0f5d31aeb92f Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Sat, 6 Oct 2018 00:47:31 -0700
-Subject: [PATCH 18/31] Fixed a crash for removing explicit instantiation
-
----
- clang_delta/RemoveUnusedFunction.cpp | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/clang_delta/RemoveUnusedFunction.cpp b/clang_delta/RemoveUnusedFunction.cpp
-index 6963ba2..747aac1 100644
---- a/clang_delta/RemoveUnusedFunction.cpp
-+++ b/clang_delta/RemoveUnusedFunction.cpp
-@@ -530,6 +530,10 @@ void RemoveUnusedFunction::removeOneExplicitInstantiation(
- const char * const FileStartBuf = SrcManager->getCharacterData(FileStartLoc);
-
- SourceLocation Loc = Spec->getPointOfInstantiation();
-+ if (Loc.isInvalid()) {
-+ TheRewriter.RemoveText(Spec->getSourceRange());
-+ return;
-+ }
- const char *OrigStartBuf = SrcManager->getCharacterData(Loc);
- const char *StartBuf = OrigStartBuf;
- int Offset = 0;
---
-2.21.0
-
diff --git a/0019-avoid-removing-nested-calls-from-member-initializers.patch b/0019-avoid-removing-nested-calls-from-member-initializers.patch
deleted file mode 100644
index c12b2be..0000000
--- a/0019-avoid-removing-nested-calls-from-member-initializers.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 2c26c5f5c84c8665625d6d03cd20b602deb1e417 Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Tue, 9 Oct 2018 23:40:19 -0700
-Subject: [PATCH 19/31] avoid removing nested calls from member initializers
-
----
- clang_delta/RemoveNestedFunction.cpp | 3 ++-
- .../remove-nested-function/remove_nested_func1.cc | 15 +++++++++++++++
- 2 files changed, 17 insertions(+), 1 deletion(-)
- create mode 100644 clang_delta/tests/remove-nested-function/remove_nested_func1.cc
-
-diff --git a/clang_delta/RemoveNestedFunction.cpp b/clang_delta/RemoveNestedFunction.cpp
-index 7666207..01d3850 100644
---- a/clang_delta/RemoveNestedFunction.cpp
-+++ b/clang_delta/RemoveNestedFunction.cpp
-@@ -106,7 +106,8 @@ bool RNFStatementVisitor::VisitCallExpr(CallExpr *CallE)
- return true;
- }
-
-- if ((std::find(ConsumerInstance->ValidCallExprs.begin(),
-+ if (CurrentStmt &&
-+ (std::find(ConsumerInstance->ValidCallExprs.begin(),
- ConsumerInstance->ValidCallExprs.end(), CallE)
- == ConsumerInstance->ValidCallExprs.end()) &&
- !ConsumerInstance->CallExprQueue.empty()) {
-diff --git a/clang_delta/tests/remove-nested-function/remove_nested_func1.cc b/clang_delta/tests/remove-nested-function/remove_nested_func1.cc
-new file mode 100644
-index 0000000..46a4697
---- /dev/null
-+++ b/clang_delta/tests/remove-nested-function/remove_nested_func1.cc
-@@ -0,0 +1,15 @@
-+// RUN: %clang_delta --transformation=remove-nested-function --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+struct S1 {
-+ S1(int);
-+};
-+int foo();
-+int bar(int);
-+struct f : S1 {
-+// CHECK: S1(bar(foo()))
-+ f() : S1(bar(foo())) {
-+// CHECK-NEXT: int __trans_tmp_1 = foo();
-+// CHECK-NEXT: bar(__trans_tmp_1);
-+ bar(foo());
-+ }
-+};
---
-2.21.0
-
diff --git a/0020-Update-RemoveUnusedEnumMember.h.patch b/0020-Update-RemoveUnusedEnumMember.h.patch
deleted file mode 100644
index d0ba38c..0000000
--- a/0020-Update-RemoveUnusedEnumMember.h.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 2f8848ada28624cd208ea051edebebbdbfa93e12 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20Janiszewski?=
- <janisozaur@users.noreply.github.com>
-Date: Sun, 28 Oct 2018 16:24:27 +0100
-Subject: [PATCH 20/31] Update RemoveUnusedEnumMember.h
-
----
- clang_delta/RemoveUnusedEnumMember.h | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/clang_delta/RemoveUnusedEnumMember.h b/clang_delta/RemoveUnusedEnumMember.h
-index e88b1df..457d5e5 100644
---- a/clang_delta/RemoveUnusedEnumMember.h
-+++ b/clang_delta/RemoveUnusedEnumMember.h
-@@ -9,8 +9,8 @@
- //
- //===----------------------------------------------------------------------===//
-
--#ifndef REMOVE_UNUSED_VAR_H
--#define REMOVE_UNUSED_VAR_H
-+#ifndef REMOVE_UNUSED_ENUM_MEMBER_H
-+#define REMOVE_UNUSED_ENUM_MEMBER_H
-
- #include <string>
- #include "llvm/ADT/DenseMap.h"
---
-2.21.0
-
diff --git a/0021-Update-include-guard.patch b/0021-Update-include-guard.patch
deleted file mode 100644
index 6d59d21..0000000
--- a/0021-Update-include-guard.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From c1a9fd77b0d53c9811135a241db5d41922822f19 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20Janiszewski?=
- <janisozaur@users.noreply.github.com>
-Date: Sun, 28 Oct 2018 16:26:17 +0100
-Subject: [PATCH 21/31] Update include guard
-
----
- clang_delta/RemoveEnumMemberValue.h | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/clang_delta/RemoveEnumMemberValue.h b/clang_delta/RemoveEnumMemberValue.h
-index da10544..55f3f32 100644
---- a/clang_delta/RemoveEnumMemberValue.h
-+++ b/clang_delta/RemoveEnumMemberValue.h
-@@ -9,8 +9,8 @@
- //
- //===----------------------------------------------------------------------===//
-
--#ifndef REMOVE_UNUSED_VAR_H
--#define REMOVE_UNUSED_VAR_H
-+#ifndef REMOVE_UNUSED_MEMBER_VALUE_H
-+#define REMOVE_UNUSED_MEMBER_VALUE_H
-
- #include <string>
- #include "llvm/ADT/DenseMap.h"
---
-2.21.0
-
diff --git a/0022-take-syntactic-form-only-if-it-s-non-null.patch b/0022-take-syntactic-form-only-if-it-s-non-null.patch
deleted file mode 100644
index 635791b..0000000
--- a/0022-take-syntactic-form-only-if-it-s-non-null.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From eca4f38e3de0b2df3de2ba014902f5b2549ee638 Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Mon, 5 Nov 2018 21:23:33 -0800
-Subject: [PATCH 22/31] take syntactic form only if it's non-null
-
----
- clang_delta/RemoveUnusedStructField.cpp | 2 +-
- .../tests/remove-unused-field/unused_field3.cpp | 11 +++++++++++
- 2 files changed, 12 insertions(+), 1 deletion(-)
- create mode 100644 clang_delta/tests/remove-unused-field/unused_field3.cpp
-
-diff --git a/clang_delta/RemoveUnusedStructField.cpp b/clang_delta/RemoveUnusedStructField.cpp
-index 66d210d..44b596f 100644
---- a/clang_delta/RemoveUnusedStructField.cpp
-+++ b/clang_delta/RemoveUnusedStructField.cpp
-@@ -303,7 +303,7 @@ void RemoveUnusedStructField::getInitExprs(const Type *Ty,
- // Extract it's syntactic form in such case.
- bool HasDesignatedInit = false;
- if (ILE->isSemanticForm()) {
-- ILE = ILE->getSyntacticForm();
-+ ILE = ILE->getSyntacticForm() == nullptr ? ILE : ILE->getSyntacticForm();
- for (unsigned I = 0; I < ILE->getNumInits(); I++) {
- if (isa<DesignatedInitExpr>(ILE->getInit(I))) {
- HasDesignatedInit = true;
-diff --git a/clang_delta/tests/remove-unused-field/unused_field3.cpp b/clang_delta/tests/remove-unused-field/unused_field3.cpp
-new file mode 100644
-index 0000000..8738588
---- /dev/null
-+++ b/clang_delta/tests/remove-unused-field/unused_field3.cpp
-@@ -0,0 +1,11 @@
-+// RUN: %clang_delta --transformation=remove-unused-field --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
-+
-+// CHECK: void foo() {
-+void foo() {
-+// CHECK: struct {
-+ struct {
-+ int m;
-+// CHECK: } a[] = {};
-+ } a[] = {1};
-+// CHECK: }
-+}
---
-2.21.0
-
diff --git a/0023-built-with-LLVM-7.0.patch b/0023-built-with-LLVM-7.0.patch
deleted file mode 100644
index ac11397..0000000
--- a/0023-built-with-LLVM-7.0.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From 7ab52fa3de154c91944effb1607e0ffe1ed39bee Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Sun, 13 Jan 2019 23:36:43 -0800
-Subject: [PATCH 23/31] built with LLVM 7.0
-
-compatible with LLVM 7.0 now
----
- 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.21.0
-
diff --git a/0024-change-ordering-so-pass_includes-is-called-after-pas.patch b/0024-change-ordering-so-pass_includes-is-called-after-pas.patch
deleted file mode 100644
index 3f3035f..0000000
--- a/0024-change-ordering-so-pass_includes-is-called-after-pas.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 7959cbe101e46dd36cd7d14118a8c7a20c575b9c Mon Sep 17 00:00:00 2001
-From: Amy Huang <akhuang@google.com>
-Date: Tue, 19 Feb 2019 17:11:12 -0800
-Subject: [PATCH 24/31] change ordering so pass_includes is called after
- pass_unifdef
-
----
- creduce/creduce.in | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/creduce/creduce.in b/creduce/creduce.in
-index 52f9e6d..cd2aba5 100644
---- a/creduce/creduce.in
-+++ b/creduce/creduce.in
-@@ -755,12 +755,12 @@ sub line_delta_pass ($) {
- my @all_methods = (
-
- { "name" => "pass_include_includes", "arg" => "0", "pri" => 100, "C" => 1, },
-- { "name" => "pass_includes", "arg" => "0", "first_pass_pri" => 0, "C" => 1, },
- { "name" => "pass_unifdef", "arg" => "0", "pri" => 450, "first_pass_pri" => 0, "C" => 1, },
- { "name" => "pass_comments", "arg" => "0", "pri" => 451, "first_pass_pri" => 0, "C" => 1, },
-- { "name" => "pass_blank", "arg" => "0", "first_pass_pri" => 1, },
-- { "name" => "pass_clang_binsrch", "arg" => "replace-function-def-with-decl", "first_pass_pri" => 2, "C" => 1, },
-- { "name" => "pass_clang_binsrch", "arg" => "remove-unused-function", "first_pass_pri" => 3, "C" => 1, },
-+ { "name" => "pass_includes", "arg" => "0", "first_pass_pri" => 1, "C" => 1, },
-+ { "name" => "pass_blank", "arg" => "0", "first_pass_pri" => 2, },
-+ { "name" => "pass_clang_binsrch", "arg" => "replace-function-def-with-decl", "first_pass_pri" => 3, "C" => 1, },
-+ { "name" => "pass_clang_binsrch", "arg" => "remove-unused-function", "first_pass_pri" => 4, "C" => 1, },
-
- { "name" => "pass_lines", "arg" => "0", "pri" => 410, "first_pass_pri" => 20, "last_pass_pri" => 999, },
- { "name" => "pass_lines", "arg" => "1", "pri" => 411, "first_pass_pri" => 21, },
---
-2.21.0
-
diff --git a/0025-add-pass-to-remove-constant-ifs.patch b/0025-add-pass-to-remove-constant-ifs.patch
deleted file mode 100644
index 892f883..0000000
--- a/0025-add-pass-to-remove-constant-ifs.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 7ccbd726414b068c40e1be9a5488467f88196a6c Mon Sep 17 00:00:00 2001
-From: Amy Huang <akhuang@google.com>
-Date: Tue, 19 Feb 2019 17:15:01 -0800
-Subject: [PATCH 25/31] add pass to remove constant ifs
-
----
- creduce/pass_unifdef.pm | 15 ++++++++++++++-
- 1 file changed, 14 insertions(+), 1 deletion(-)
-
-diff --git a/creduce/pass_unifdef.pm b/creduce/pass_unifdef.pm
-index 72c8219..a6f70cf 100644
---- a/creduce/pass_unifdef.pm
-+++ b/creduce/pass_unifdef.pm
-@@ -49,7 +49,7 @@ sub check_prereqs () {
- }
-
- sub new ($$) {
-- my $index = 0;
-+ my $index = -1;
- return \$index;
- }
-
-@@ -72,6 +72,19 @@ sub transform ($$$) {
- close INF;
- my @deflist = sort keys %defs;
- my $tmpfile = File::Temp::tmpnam();
-+
-+ # remove constant ifs
-+ if ($index == -1) {
-+ my $cmd = "$unifdef -k -o $tmpfile $cfile >/dev/null 2>&1";
-+ runit ($cmd);
-+ $index++;
-+ if (compare($cfile, $tmpfile) == 0) {
-+ goto AGAIN;
-+ }
-+ File::Copy::move($tmpfile, $cfile);
-+ return ($OK, \$index);
-+ }
-+
- AGAIN:
- print "index = $index\n" if $DEBUG;
- my $DU = (($index % 2) == 0) ? "-D" : "-U";
---
-2.21.0
-
diff --git a/0026-add-pass-for-line-markers.patch b/0026-add-pass-for-line-markers.patch
deleted file mode 100644
index edec09c..0000000
--- a/0026-add-pass-for-line-markers.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-From 241ee54f3a504235f7da6c76ba43fa04fbb477ab Mon Sep 17 00:00:00 2001
-From: Amy Huang <akhuang@google.com>
-Date: Wed, 20 Feb 2019 13:52:26 -0800
-Subject: [PATCH 26/31] add pass for line markers
-
----
- creduce/CMakeLists.txt | 3 +
- creduce/Makefile.am | 1 +
- creduce/Makefile.in | 1 +
- creduce/creduce.in | 1 +
- creduce/pass_line_markers.pm | 113 +++++++++++++++++++++++++++++++++++
- 5 files changed, 119 insertions(+)
- create mode 100644 creduce/pass_line_markers.pm
-
-diff --git a/creduce/CMakeLists.txt b/creduce/CMakeLists.txt
-index 05d74a7..675af07 100644
---- a/creduce/CMakeLists.txt
-+++ b/creduce/CMakeLists.txt
-@@ -235,6 +235,9 @@ add_custom_target(Modules ALL
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${PROJECT_SOURCE_DIR}/pass_ints.pm
- ${PROJECT_BINARY_DIR}
-+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
-+ ${PROJECT_SOURCE_DIR}/pass_line_markers.pm
-+ ${PROJECT_BINARY_DIR}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${PROJECT_SOURCE_DIR}/pass_lines.pm
- ${PROJECT_BINARY_DIR}
-diff --git a/creduce/Makefile.am b/creduce/Makefile.am
-index bb6fd69..525093c 100644
---- a/creduce/Makefile.am
-+++ b/creduce/Makefile.am
-@@ -28,6 +28,7 @@ dist_perllib_DATA = \
- pass_includes.pm \
- pass_indent.pm \
- pass_ints.pm \
-+ pass_line_markers.pm \
- pass_lines.pm \
- pass_peep.pm \
- pass_special.pm \
-diff --git a/creduce/Makefile.in b/creduce/Makefile.in
-index 6477ec4..ca44e65 100644
---- a/creduce/Makefile.in
-+++ b/creduce/Makefile.in
-@@ -320,6 +320,7 @@ dist_perllib_DATA = \
- pass_includes.pm \
- pass_indent.pm \
- pass_ints.pm \
-+ pass_line_markers.pm \
- pass_lines.pm \
- pass_peep.pm \
- pass_special.pm \
-diff --git a/creduce/creduce.in b/creduce/creduce.in
-index cd2aba5..b666908 100644
---- a/creduce/creduce.in
-+++ b/creduce/creduce.in
-@@ -758,6 +758,7 @@ my @all_methods = (
- { "name" => "pass_unifdef", "arg" => "0", "pri" => 450, "first_pass_pri" => 0, "C" => 1, },
- { "name" => "pass_comments", "arg" => "0", "pri" => 451, "first_pass_pri" => 0, "C" => 1, },
- { "name" => "pass_includes", "arg" => "0", "first_pass_pri" => 1, "C" => 1, },
-+ { "name" => "pass_line_markers", "arg" => "0", "first_pass_pri" => 1, "C" => 1, },
- { "name" => "pass_blank", "arg" => "0", "first_pass_pri" => 2, },
- { "name" => "pass_clang_binsrch", "arg" => "replace-function-def-with-decl", "first_pass_pri" => 3, "C" => 1, },
- { "name" => "pass_clang_binsrch", "arg" => "remove-unused-function", "first_pass_pri" => 4, "C" => 1, },
-diff --git a/creduce/pass_line_markers.pm b/creduce/pass_line_markers.pm
-new file mode 100644
-index 0000000..9d81967
---- /dev/null
-+++ b/creduce/pass_line_markers.pm
-@@ -0,0 +1,113 @@
-+## -*- mode: Perl -*-
-+##
-+## Copyright (c) 2019 The University of Utah
-+## All rights reserved.
-+##
-+## This file is distributed under the University of Illinois Open Source
-+## License. See the file COPYING for details.
-+
-+###############################################################################
-+
-+package pass_line_markers;
-+
-+use strict;
-+use warnings;
-+
-+use File::Copy;
-+use File::Compare;
-+use creduce_utils;
-+
-+sub check_prereqs () {
-+ return 1;
-+}
-+
-+sub count_line_markers ($$) {
-+ (my $cfile, my $which) = @_;
-+ open INF, "<$cfile" or die;
-+ my $n = 0;
-+ while (my $line = <INF>) {
-+ if ($line =~ m/^\s*#\s*[0-9]+/) {
-+ $n++;
-+ }
-+ }
-+ close INF;
-+ return $n;
-+}
-+
-+sub new ($$) {
-+ my ($cfile, $which) = @_;
-+ my %sh;
-+ my $instances = count_line_markers($cfile, $which);
-+ $sh{"index"} = $instances;
-+ $sh{"chunk"} = $instances;
-+ return \%sh;
-+}
-+
-+sub advance ($$$) {
-+ (my $cfile, my $which, my $state) = @_;
-+ my %sh = %{$state};
-+
-+ $sh{"index"} -= $sh{"chunk"};
-+ if ($DEBUG) {
-+ my $index = $sh{"index"};
-+ my $chunk = $sh{"chunk"};
-+ print "ADVANCE: index = $index, chunk = $chunk\n";
-+ }
-+ return \%sh;
-+}
-+
-+sub transform ($$$) {
-+ my ($cfile, $which, $state) = @_;
-+ my %sh = %{$state};
-+
-+ AGAIN:
-+
-+ my $instances = count_line_markers($cfile, $which);
-+ $sh{"index"} = $instances if ($sh{"index"} > $instances);
-+ my $index = $sh{"index"};
-+ my $chunk = $sh{"chunk"};
-+
-+ if ($index >= 0 && $instances > 0 && $chunk > 0) {
-+ my $start = $index - $chunk;
-+ $start = 0 if ($start < 0);
-+
-+ open INF, "<$cfile" or die;
-+ my $tmpfile = File::Temp::tmpnam();
-+ open OUTF, ">$tmpfile" or die;
-+ my $line_markers = -1;
-+ while (my $line = <INF>) {
-+ if ($line =~ m/^\s*#\s*[0-9]+/) {
-+ $line_markers++;
-+ if ($line_markers >= $start && $line_markers < $index) {
-+ next;
-+ }
-+ }
-+ print OUTF $line;
-+ }
-+ close INF;
-+ close OUTF;
-+
-+ my $new_instances = count_line_markers($tmpfile, $which);
-+ print "went from $instances line markers to $new_instances ",
-+ "with chunk $chunk\n" if $DEBUG;
-+
-+ if (compare($cfile, $tmpfile) == 0) {
-+ print "did not change file\n" if $DEBUG;
-+ unlink $tmpfile;
-+ $sh{"index"} -= $sh{"chunk"};
-+ goto AGAIN;
-+ }
-+ File::Copy::move($tmpfile, $cfile);
-+ } else {
-+ return ($STOP, \%sh) if ($chunk < 10);
-+ my $newchunk = int ($chunk / 2.0);
-+ $sh{"chunk"} = $newchunk;
-+ print "granularity reduced to $newchunk\n" if $DEBUG;
-+ $sh{"index"} = $instances;
-+ goto AGAIN;
-+ }
-+
-+ return ($OK, \%sh);
-+}
-+
-+1;
---
-2.21.0
-
diff --git a/0027-add-binary-search-removal-of-c-style-comments.patch b/0027-add-binary-search-removal-of-c-style-comments.patch
deleted file mode 100644
index cd901af..0000000
--- a/0027-add-binary-search-removal-of-c-style-comments.patch
+++ /dev/null
@@ -1,176 +0,0 @@
-From cd1895ab8438c7f674293ab3d673ffdc9ee3b562 Mon Sep 17 00:00:00 2001
-From: Amy Huang <akhuang@google.com>
-Date: Thu, 21 Feb 2019 10:33:38 -0800
-Subject: [PATCH 27/31] add binary search removal of c++ style comments
-
----
- creduce/pass_comments.pm | 131 +++++++++++++++++++++++++++++++--------
- 1 file changed, 106 insertions(+), 25 deletions(-)
-
-diff --git a/creduce/pass_comments.pm b/creduce/pass_comments.pm
-index c077427..b9b8380 100644
---- a/creduce/pass_comments.pm
-+++ b/creduce/pass_comments.pm
-@@ -13,6 +13,7 @@ package pass_comments;
- use strict;
- use warnings;
-
-+use File::Compare;
- use creduce_utils;
- use Regexp::Common qw /comment/;
-
-@@ -20,46 +21,126 @@ sub check_prereqs () {
- return 1;
- }
-
-+sub count_comments ($$) {
-+ my ($cfile, $which) = @_;
-+ open INF, "<$cfile" or die;
-+ my $n = 0;
-+ while (my $line = <INF>) {
-+ if ($line =~ m/\/\/(.*?)$/) {
-+ $n++;
-+ }
-+ }
-+ close INF;
-+ return $n;
-+}
-+
- sub new ($$) {
-- my $index = -2;
-- return \$index;
-+ my ($cfile, $which) = @_;
-+ my %sh;
-+ $sh{"pass"} = -2;
-+ $sh{"start"} = 1;
-+ return \%sh;
- }
-
- sub advance ($$$) {
-- (my $cfile, my $arg, my $state) = @_;
-- my $index = ${$state};
-- $index++;
-- return \$index;
-+ (my $cfile, my $which, my $state) = @_;
-+ my %sh = %{$state};
-+
-+ my $pass = $sh{"pass"};
-+ if ($pass < 0) {
-+ $sh{"pass"}++;
-+ } else {
-+ $sh{"index"} += $sh{"chunk"};
-+ }
-+ return \%sh;
-+}
-+
-+sub do_transform_binsrch ($$$$) {
-+ my ($cfile, $tmpfile, $which, $state) = @_;
-+ my %sh = %{$state};
-+
-+ my $instances = count_comments($cfile, $which);
-+ my $index = $sh{"index"};
-+ my $chunk = $sh{"chunk"};
-+
-+ if ($index < $instances && $instances > 0) {
-+ open INF, "<$cfile" or die;
-+ open OUTF, ">$tmpfile" or die;
-+ my $comments = -1;
-+ while (my $line = <INF>) {
-+ my $newline = $line;
-+ if ($line =~ m/\/\/(.*?)$/) {
-+ $comments++;
-+ if ($comments >= $index && $comments < $index + $chunk) {
-+ $newline =~ s/\/\/(.*?)$//g;
-+ }
-+ }
-+ print OUTF $newline;
-+ }
-+ close INF;
-+ close OUTF;
-+
-+ my $new_instances = count_comments($tmpfile, $which);
-+ print "went from $instances comments to $new_instances ",
-+ "with chunk $chunk\n" if $DEBUG;
-+
-+ return 0;
-+ }
-+ return 1;
- }
-
- sub transform ($$$) {
- (my $cfile, my $which, my $state) = @_;
-- my $index = ${$state};
-+ my %sh = %{$state};
-
- my $prog = read_file ($cfile);
- my $prog2 = $prog;
-+ my $tmpfile = File::Temp::tmpnam();
-
- AGAIN:
-- if ($index == -2) {
-- # remove all C-style comments
-- $prog2 =~ s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $2 ? $2 : ""#gse;
-- } elsif ($index == -1) {
-- # remove all C++-style comments
-- $prog2 =~ s/\/\/(.*?)$//gm;
-- } else {
-- # TODO remove only the nth comment
-- }
-- if (($prog eq $prog2) && ($index == -2)) {
-- $index = -1;
-- goto AGAIN;
-+ my $pass = $sh{"pass"};
-+ if ($pass == -2) {
-+ # remove all C-style comments
-+ $prog2 =~ s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $2 ? $2 : ""#gse;
-+ write_file($tmpfile, $prog2);
-+ } elsif ($pass == -1) {
-+ # remove all C++-style comments
-+ $prog2 =~ s/\/\/(.*?)$//gm;
-+ write_file($tmpfile, $prog2);
-+ } elsif ($pass == 0) {
-+ # remove C++-style comments with binary search
-+
-+ if (defined($sh{"start"})) {
-+ delete $sh{"start"};
-+ $sh{"index"} = 0;
-+ $sh{"chunk"} = count_comments($cfile, $which);
-+ }
-+
-+ my $rechunk = do_transform_binsrch($cfile, $tmpfile, $which, \%sh);
-+
-+ if ($rechunk) {
-+ return ($STOP, \%sh) if ($sh{"chunk"} <= 1);
-+ my $newchunk = int ($sh{"chunk"} / 2.0);
-+ $sh{"chunk"} = $newchunk;
-+ print "granularity reduced to $newchunk\n" if $DEBUG;
-+ $sh{"index"} = 0;
-+ goto AGAIN;
-+ }
- }
--
-- if ($prog ne $prog2) {
-- write_file ($cfile, $prog2);
-- return ($OK, \$index);
-- } else {
-- return ($STOP, \$index);
-+
-+ if (compare($cfile, $tmpfile) == 0) {
-+ print "did not change file\n" if $DEBUG;
-+ unlink $tmpfile;
-+ if ($pass < 0) {
-+ $sh{"pass"}++;
-+ } else {
-+ $sh{"index"} += $sh{"chunk"};
-+ }
-+ goto AGAIN;
- }
-+
-+ File::Copy::move($tmpfile, $cfile);
-+ return ($OK, \%sh);
- }
-
- 1;
---
-2.21.0
-
diff --git a/0028-convert-to-markdown.patch b/0028-convert-to-markdown.patch
deleted file mode 100644
index eaa72c8..0000000
--- a/0028-convert-to-markdown.patch
+++ /dev/null
@@ -1,395 +0,0 @@
-From 68dbcdd0350db747990a6f7945222b143ac777ec Mon Sep 17 00:00:00 2001
-From: John Regehr <regehr@cs.utah.edu>
-Date: Fri, 22 Feb 2019 22:18:35 -0700
-Subject: [PATCH 28/31] convert to markdown
-
----
- INSTALL => INSTALL.md | 187 ++++++++++++++++++++++--------------------
- README => README.md | 43 ++++------
- 2 files changed, 115 insertions(+), 115 deletions(-)
- rename INSTALL => INSTALL.md (51%)
- rename README => README.md (52%)
-
-diff --git a/INSTALL b/INSTALL.md
-similarity index 51%
-rename from INSTALL
-rename to INSTALL.md
-index 8bca8d2..be38721 100644
---- a/INSTALL
-+++ b/INSTALL.md
-@@ -1,17 +1,18 @@
---*- mode: Text -*-
-+# Installing C-Reduce
-
----------------------------------------------------------------------
--
--C-Reduce
-+## Using a Package Manager
-
- Before compiling C-Reduce yourself, you might want to see if your OS
- comes with a precompiled package for C-Reduce. Ubuntu, Debian, Gentoo,
- and Mac OS X (Homebrew) all do. For example, on OS X:
-
-+```
- $ brew install creduce
-+```
-+
-+## From Source
-
----------------------------------------------------------------------
--Prereqs:
-+### Prereqs
-
- C-Reduce is written in Perl, C++, and C. To compile and run C-Reduce,
- you will need a development environment that supports these languages.
-@@ -23,84 +24,80 @@ third-party software packages, including LLVM.
- On Ubuntu or Mint, the prerequisites other than LLVM can be installed
- like this:
-
-- sudo apt-get install \
-- libexporter-lite-perl libfile-which-perl libgetopt-tabular-perl \
-- libregexp-common-perl flex build-essential \
-- zlib1g-dev
-+```
-+sudo apt-get install \
-+ libexporter-lite-perl libfile-which-perl libgetopt-tabular-perl \
-+ libregexp-common-perl flex build-essential zlib1g-dev
-+```
-
--On OS X, Perlbrew provides an easy and flexible way to get Perl and
--Perl modules installed:
--
-- http://perlbrew.pl/
-+On OS X, [Perlbrew](http://perlbrew.pl/) provides an easy and flexible
-+way to get Perl and Perl modules installed
-
- On FreeBSD 10.3 and 11.1, the prerequisites can be installed like this:
-
-- sudo pkg install \
-- llvm60 \
-- p5-Exporter-Lite p5-File-Which p5-Getopt-Tabular p5-Regexp-Common \
-- flex
-+```
-+sudo pkg install \
-+ llvm60 flex p5-Exporter-Lite p5-File-Which p5-Getopt-Tabular p5-Regexp-Common
-+```
-
- Otherwise, install these packages either manually or using the package
- manager:
-
--Flex:
-- http://flex.sourceforge.net/
-+* [Flex](http://flex.sourceforge.net/)
-
--LLVM/Clang 6.0.0:
-- http://llvm.org/releases/download.html#6.0.0
-- (No need to compile it: the appropriate "Clang binaries" package is
-- all you need. If you use one of the binary packages, you may need to
-- install additional packages that the binary package depends on. For
-- example, the "Clang for x86_64 Ubuntu 14.04" binary package depends
-- on "libtinfo5". You may need to install this, e.g.:
-- "sudo apt-get install libtinfo-dev".)
-+* [LLVM/Clang 6.0.0](http://llvm.org/releases/download.html#6.0.0)
-
--Perl modules:
-- Exporter::Lite
-- File::Which
-- Getopt::Tabular
-- Regexp::Common
-+ (No need to compile it: the appropriate "Clang binaries" package is
-+ all you need. If you use one of the binary packages, you may need
-+ to install additional packages that the binary package depends on.
-+ For example, the "Clang for x86_64 Ubuntu 14.04" binary package
-+ depends on "libtinfo5". You may need to install this, e.g.: "sudo
-+ apt-get install libtinfo-dev".)
-
--For example, (perhaps as root):
-- cpan -i 'Exporter::Lite'
-- cpan -i 'File::Which'
-- cpan -i 'Getopt::Tabular'
-- cpan -i 'Regexp::Common'
-+* Perl modules:
-+ - Exporter::Lite
-+ - File::Which
-+ - Getopt::Tabular
-+ - Regexp::Common
-+ - For example, (perhaps as root) `cpan -i Exporter::Lite File::Which Getopt::Tabular Regexp::Common`
-
--zlib:
-- http://www.zlib.net/
-+* [zlib](http://www.zlib.net/)
-
----------------------------------------------------------------------
--Optional prereqs:
-+### Optional Prereqs
-
--Term::ReadKey is optional; C-Reduce will use it if it is installed.
-+`Term::ReadKey` is optional; C-Reduce will use it if it is installed.
-
- On Ubuntu:
-
-- sudo apt-get install libterm-readkey-perl
-+```
-+sudo apt-get install libterm-readkey-perl
-+```
-
- On OS X (with Homebrew + Perlbrew installed):
-
-- cpan -i 'Term::ReadKey'
-+```
-+cpan -i Term::ReadKey
-+```
-
- On FreeBSD 10.3:
-
-- sudo pkg install p5-Term-ReadKey
-+```
-+sudo pkg install p5-Term-ReadKey
-+```
-
- Otherwise, install the packages either manually or using the package
- manager.
-
----------------------------------------------------------------------
--Building and installing C-Reduce:
-+## Building and installing C-Reduce
-
- You can configure, build, and install C-Reduce with the provided
--`configure' script or with CMake.
-+`configure` script or with CMake.
-
--* Preface: If in Doubt, Compile With `clang++'
-+### Preface: If in Doubt, Compile With clang++
-
- If you encounter weird C++ link-time errors while trying to compile
--C-Reduce (in particular, while compiling its internal `clang_delta'
--tool), please try compiling with `clang++'.
-+C-Reduce (in particular, while compiling its internal `clang_delta`
-+tool), please try compiling with clang++.
-
- We have encountered link-time problems while trying to compile
- C-Reduce with GCC 5.* and the precompiled LLVM binaries available
-@@ -112,83 +109,96 @@ If you are curious, for some discussion of this issue, see:
- <https://github.com/csmith-project/creduce/issues/101>
- <https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html>
-
--* The `configure' Way
-+### The `configure` Way
-
- From either the source directory or a build directory:
-
-- [source-path/]configure [options]
-- make
-- make install
-+```
-+[source-path/]configure [options]
-+make
-+make install
-+```
-
--The `configure' script was generated by GNU Autoconf, and therefore
-+The `configure` script was generated by GNU Autoconf, and therefore
- accepts the usual options for naming the installation directories,
--choosing the compilers you want to use, and so on. `configure --help'
-+choosing the compilers you want to use, and so on. `configure --help`
- summarizes the command-line options.
-
--If LLVM/Clang is not in your search path, you can tell the `configure'
-+If LLVM/Clang is not in your search path, you can tell the `configure`
- script where to find LLVM/Clang:
-
-- # Use the LLVM/Clang tree rooted at /opt/llvm
-- configure --with-llvm=/opt/llvm
-+```
-+# Use the LLVM/Clang tree rooted at /opt/llvm
-+configure --with-llvm=/opt/llvm
-+```
-
- If you choose to build LLVM and Clang yourself, *and* if you choose to
- keep your LLVM and Clang build trees separate, you can tell the
--`configure' script where to find your separate Clang tree:
-+`configure` script where to find your separate Clang tree:
-
-- # Use separate LLVM and Clang build trees, /work/my-{llvm,clang}
-- configure --with-llvm=/work/my-llvm \
-- --with-clang=/work/my-clang
-+```
-+# Use separate LLVM and Clang build trees, /work/my-{llvm,clang}
-+configure --with-llvm=/work/my-llvm --with-clang=/work/my-clang
-+```
-
--You do *not* need to specify `--with-clang' if you build Clang within
-+You do *not* need to specify `--with-clang` if you build Clang within
- your LLVM tree. Also note that you must actually *build* LLVM and
- Clang before building C-Reduce.
-
- Note that assertions are enabled by default (which is probably what
- you want). To disable assertions:
-
-- configure --disable-trans-assert
-+```
-+configure --disable-trans-assert
-+```
-
- The generated Makefiles require GNU Make. BSD Make will not work.
- If you see weird make-time errors, please check that you are using
- GNU Make.
-
--* The CMake Way
-+### The CMake Way
-
- From either the source directory or a build directory:
-
-- cmake [source-dir] [options]
-- make
-- make install
-+```
-+cmake [source-dir] [options]
-+make
-+make install
-+```
-
- If LLVM/Clang is not in your search path, you can tell CMake where to
- find LLVM/Clang:
-
-- # Use the LLVM/Clang tree rooted at /opt/llvm
-- cmake [source-dir] -DCMAKE_PREFIX_PATH=/opt/llvm
-+```
-+# Use the LLVM/Clang tree rooted at /opt/llvm
-+cmake [source-dir] -DCMAKE_PREFIX_PATH=/opt/llvm
-+```
-
- Alternatively, if you choose to build LLVM and Clang yourself, you can
--set the LLVM_DIR and/or Clang_DIR variables to paths where CMake can
--find the `LLVMConfig.cmake' and/or `ClangConfig.cmake' files. The
--value of LLVM_DIR is usually "./lib/cmake/llvm", relative to your LLVM
--build or install directory. Similarly, the value of Clang_DIR is
--usually "./lib/cmake/clang", relative to your Clang build or install
-+set the `LLVM_DIR` and/or `Clang_DIR` variables to paths where CMake can
-+find the `LLVMConfig.cmake` and/or `ClangConfig.cmake` files. The
-+value of `LLVM_DIR` is usually `./lib/cmake/llvm`, relative to your LLVM
-+build or install directory. Similarly, the value of `Clang_DIR` is
-+usually `./lib/cmake/clang`, relative to your Clang build or install
- directory. For example:
-
-- # Use separate LLVM and Clang build trees, /work/my-{llvm,clang}
-- cmake [source-dir] -DLLVM_DIR=/work/my-llvm/lib/cmake/llvm \
-- -DClang_DIR=/work/my-clang/lib/cmake/clang
-+```
-+# Use separate LLVM and Clang build trees, /work/my-{llvm,clang}
-+cmake [source-dir] -DLLVM_DIR=/work/my-llvm/lib/cmake/llvm \
-+ -DClang_DIR=/work/my-clang/lib/cmake/clang
-+```
-
--You do *not* need to set Clang_DIR if you build Clang within your LLVM
-+You do *not* need to set `Clang_DIR` if you build Clang within your LLVM
- tree. Also, note that you must actually *build* LLVM and Clang before
- building C-Reduce.
-
--Note that assertions are enabled by default (which is probably what
--you want). To disable assertions:
-+Note that assertions are enabled by default. To disable assertions:
-
-- cmake ... -DENABLE_TRANS_ASSERT=OFF
-+```
-+cmake ... -DENABLE_TRANS_ASSERT=OFF
-+```
-
----------------------------------------------------------------------
--Regarding LLVM versions:
-+## Regarding LLVM versions
-
- Released versions of C-Reduce, and also our master branch at GitHub,
- need to be compiled against specific released versions of LLVM, as
-@@ -198,7 +208,6 @@ Our GitHub repo usually also has a branch called llvm-svn-compatible
- that supports building C-Reduce against LLVMs that are newer than the
- last released version. The most recent version of LLVM that the
- llvm-svn-compatible branch is known to compile against is recorded in
--LAST_KNOWN_WORKING_LLVM. C-Reduce may happen to also build against
-+`LAST_KNOWN_WORKING_LLVM`. C-Reduce may happen to also build against
- revisions before or after this, but we make no guarantees.
-
----------------------------------------------------------------------
-diff --git a/README b/README.md
-similarity index 52%
-rename from README
-rename to README.md
-index 492b6f5..2b9f79e 100644
---- a/README
-+++ b/README.md
-@@ -1,8 +1,6 @@
---*- mode: Text -*-
-+# C-Reduce
-
----------------------------------------------------------------------
--
--About C-Reduce:
-+## About
-
- C-Reduce is a tool that takes a large C or C++ program that has a
- property of interest (such as triggering a compiler bug) and
-@@ -10,41 +8,35 @@ automatically produces a much smaller C/C++ program that has the same
- property. It is intended for use by people who discover and report
- bugs in compilers and other tools that process C/C++ code.
-
--NOTE: C-Reduce happens to do a pretty good job reducing the size of
-+*NOTE:* C-Reduce happens to do a pretty good job reducing the size of
- programs in languages other than C/C++, such as JavaScript and Rust.
- If you need to reduce programs in some other language, please give it
- a try.
-
--Documentation and other information can be found at the C-Reduce web
--page:
--
-- http://embed.cs.utah.edu/creduce/
--
----------------------------------------------------------------------
--
--Installation:
-+Documentation and other information can be found at the [C-Reduce web
-+page](http://embed.cs.utah.edu/creduce/)
-
--see the file INSTALL
-+## Installation
-
----------------------------------------------------------------------
-+See [INSTALL.md](https://github.com/csmith-project/creduce/blob/master/INSTALL.md)
-
--Notes:
-+## Notes
-
- 1. When set to use more than one core, C-Reduce can cause space in
--/tmp to be leaked. This happens because sometimes C-Reduce will kill a
--compiler invocation when a result that is computed in parallel makes
-+`/tmp` to be leaked. This happens because sometimes C-Reduce will kill
-+a compiler invocation when a result that is computed in parallel makes
- it clear that that compiler invocation is no longer useful. If the
--compiler leaves files in /tmp when it is killed, C-Reduce has no way
-+compiler leaves files in `/tmp` when it is killed, C-Reduce has no way
- to discover and remove the files. You will need to do this manually
- from time to time if temporary file space is limited. The leakage is
- typically pretty slow. If you need to avoid this problem altogether,
--you can run C-Reduce on a single core (using "--n 1") in which case
-+you can run C-Reduce on a single core (using `--n 1`) in which case
- C-Reduce will never kill a running compiler instance. Alternatively, a
--command line option such as -pipe (supported by gcc) may suppress the
--creation of temporary files altogether. Another possibility is to set
--the TMPDIR environment variable to something like "/tmp/creduce-stuff"
--before invoking C-Reduce -- assuming that the tools you are invoking
--respect this variable.
-+command line option such as `-pipe` (supported by GCC) may suppress
-+the creation of temporary files altogether. Another possibility is to
-+set the `TMPDIR` environment variable to something like
-+`/tmp/creduce-stuff` before invoking C-Reduce -- assuming that the
-+tools you are invoking respect this variable.
-
- 2. Each invocation of the interestingness test is performed in a fresh
- temporary directory containing a copy of the file that is being
-@@ -52,4 +44,3 @@ reduced. If your interestingness test requires access to other files,
- you should either copy them into the current working directory or else
- refer to them using an absolute path.
-
----------------------------------------------------------------------
---
-2.21.0
-
diff --git a/0029-patch-from-Mingwandroid-to-update-to-LLVM-7.patch b/0029-patch-from-Mingwandroid-to-update-to-LLVM-7.patch
deleted file mode 100644
index 612808e..0000000
--- a/0029-patch-from-Mingwandroid-to-update-to-LLVM-7.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-From 870add1c1a678b3781edeae7129299b22a977a8d Mon Sep 17 00:00:00 2001
-From: John Regehr <regehr@cs.utah.edu>
-Date: Sat, 23 Feb 2019 09:51:51 -0700
-Subject: [PATCH 29/31] patch from Mingwandroid to update to LLVM 7
-
----
- .travis.yml | 6 +++---
- INSTALL.md | 3 +--
- clang_delta/ExpressionDetector.cpp | 18 +++++++++---------
- clang_delta/RemoveUnusedEnumMember.cpp | 10 ++++------
- configure | 6 +++---
- configure.ac | 2 +-
- scripts/travis_deps.sh | 16 ++++++++--------
- 7 files changed, 29 insertions(+), 32 deletions(-)
-
-diff --git a/.travis.yml b/.travis.yml
-index 5a8727f..2014b23 100644
---- a/.travis.yml
-+++ b/.travis.yml
-@@ -17,9 +17,9 @@ before_install:
- - sudo scripts/travis_deps.sh
-
- script: >
-- CXX=/usr/lib/llvm-6.0/bin/clang++
-- CC=/usr/lib/llvm-6.0/bin/clang
-- ./configure --with-llvm=/usr/lib/llvm-6.0 &&
-+ CXX=/usr/lib/llvm-7/bin/clang++
-+ CC=/usr/lib/llvm-7/bin/clang
-+ ./configure --with-llvm=/usr/lib/llvm-7 &&
- make -j2 &&
- make check
-
-diff --git a/INSTALL.md b/INSTALL.md
-index be38721..afbb832 100644
---- a/INSTALL.md
-+++ b/INSTALL.md
-@@ -45,8 +45,7 @@ manager:
-
- * [Flex](http://flex.sourceforge.net/)
-
--* [LLVM/Clang 6.0.0](http://llvm.org/releases/download.html#6.0.0)
--
-+* [LLVM/Clang 7.0.0](http://llvm.org/releases/download.html#7.0.0)
- (No need to compile it: the appropriate "Clang binaries" package is
- all you need. If you use one of the binary packages, you may need
- to install additional packages that the binary package depends on.
-diff --git a/clang_delta/ExpressionDetector.cpp b/clang_delta/ExpressionDetector.cpp
-index dd77068..62d860f 100644
---- a/clang_delta/ExpressionDetector.cpp
-+++ b/clang_delta/ExpressionDetector.cpp
-@@ -78,15 +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*/,
-- SrcMgr::CharacteristicKind /*FileType*/)
-+ 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 469db3f..fbce87a 100644
---- a/clang_delta/RemoveUnusedEnumMember.cpp
-+++ b/clang_delta/RemoveUnusedEnumMember.cpp
-@@ -99,15 +99,13 @@ void RemoveUnusedEnumMember::removeEnumConstantDecl()
- {
- SourceLocation StartLoc = (*TheEnumIterator)->getLocStart();
- if (StartLoc.isMacroID()) {
-- CharSourceRange CSRange =
-- SrcManager->getExpansionRange(StartLoc);
-- StartLoc = CSRange.getBegin();
-+ CharSourceRange Range = SrcManager->getExpansionRange(StartLoc);
-+ StartLoc = Range.getBegin();
- }
- SourceLocation EndLoc = (*TheEnumIterator)->getLocEnd();
- if (EndLoc.isMacroID()) {
-- CharSourceRange CSRange =
-- SrcManager->getExpansionRange(EndLoc);
-- EndLoc = CSRange.getEnd();
-+ CharSourceRange Range = SrcManager->getExpansionRange(EndLoc);
-+ EndLoc = Range.getEnd();
- }
- SourceLocation CommaLoc = Lexer::findLocationAfterToken(
- EndLoc, tok::comma, *SrcManager, Context->getLangOpts(),
-diff --git a/configure b/configure
-index 8887357..32267f1 100755
---- a/configure
-+++ b/configure
-@@ -15852,7 +15852,7 @@ fi
- as_fn_error $? "LLVM is required but program \`llvm-config' cannot be found in $with_llvm_path" "$LINENO" 5
- fi
-
-- if test -n "6.0"; then
-+ if test -n "7.0"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LLVM version" >&5
- $as_echo_n "checking for LLVM version... " >&6; }
- LLVM_VERSION=`$LLVM_CONFIG --version`
-@@ -15877,7 +15877,7 @@ $as_echo "$LLVM_VERSION" >&6; }
- -e 's/[^0-9]//g'`
-
-
-- ax_compare_version_B=`echo "6.0" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
-+ ax_compare_version_B=`echo "7.0" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
- -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
- -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
- -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
-@@ -15892,7 +15892,7 @@ x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version
- if test "$ax_compare_version" = "true" ; then
- :
- else
-- as_fn_error $? "LLVM version 6.0 or later is required" "$LINENO" 5
-+ as_fn_error $? "LLVM version 7.0 or later is required" "$LINENO" 5
-
- fi
-
-diff --git a/configure.ac b/configure.ac
-index a2de73b..e236ff9 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -37,7 +37,7 @@ AM_PROG_CC_C_O
- AC_PROG_CXX
- AC_PROG_LIBTOOL
-
--AX_LLVM([6.0],[engine])
-+AX_LLVM([7.0],[engine])
- AX_CLANG
-
- # Handle configure-time choice of assertion-checking method.
-diff --git a/scripts/travis_deps.sh b/scripts/travis_deps.sh
-index 0600bf0..9fab08d 100755
---- a/scripts/travis_deps.sh
-+++ b/scripts/travis_deps.sh
-@@ -28,23 +28,23 @@ apt-get install -y -qq \
- software-properties-common \
- wget
-
--# Set up for installing LLVM 6.0.
-+# Set up for installing LLVM 7.0
- # See <https://wiki.ubuntu.com/ToolChain>.
- # See <http://llvm.org/apt/>.
- add-apt-repository -y \
- ppa:ubuntu-toolchain-r/test
- add-apt-repository -y \
-- 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main'
-+ 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main'
- wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
- apt-get update -qq
-
--# Install LLVM 6.0. See file "INSTALL".
-+# Install LLVM 7.0. See file "INSTALL".
- apt-get install -y -qq \
-- llvm-6.0 \
-- llvm-6.0-dev \
-- clang-6.0 \
-- libclang-6.0-dev \
-- clang-format-6.0 \
-+ llvm-7 \
-+ llvm-7-dev \
-+ clang-7 \
-+ libclang-7-dev \
-+ clang-format-7 \
- libedit-dev
-
- # Install other C-Reduce dependencies. See file "INSTALL".
---
-2.21.0
-
diff --git a/0030-skip-inlining-calls-in-default-arguments.patch b/0030-skip-inlining-calls-in-default-arguments.patch
deleted file mode 100644
index 32171be..0000000
--- a/0030-skip-inlining-calls-in-default-arguments.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From e18bb56a4eb94865bc47f766a75e113b6aaf649d Mon Sep 17 00:00:00 2001
-From: Yang Chen <chenyang@cs.utah.edu>
-Date: Sun, 24 Feb 2019 19:20:02 -0800
-Subject: [PATCH 30/31] skip inlining calls in default arguments
-
----
- clang_delta/SimpleInliner.cpp | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/clang_delta/SimpleInliner.cpp b/clang_delta/SimpleInliner.cpp
-index df384bb..8728dcc 100644
---- a/clang_delta/SimpleInliner.cpp
-+++ b/clang_delta/SimpleInliner.cpp
-@@ -69,6 +69,8 @@ public:
-
- bool TraverseConstructorInitializer(CXXCtorInitializer *Init);
-
-+ bool TraverseParmVarDecl(ParmVarDecl *PV);
-+
- unsigned int getNumStmts(void) {
- return NumStmts;
- }
-@@ -186,6 +188,11 @@ bool SimpleInlinerCollectionVisitor::TraverseConstructorInitializer(
- return true;
- }
-
-+bool SimpleInlinerCollectionVisitor::TraverseParmVarDecl(ParmVarDecl *PV)
-+{
-+ return true;
-+}
-+
- bool SimpleInlinerFunctionVisitor::VisitReturnStmt(ReturnStmt *RS)
- {
- ConsumerInstance->ReturnStmts.push_back(RS);
---
-2.21.0
-
diff --git a/0031-Update-llvm-svn-compatible-branch-for-ToT-clang.patch b/0031-Update-llvm-svn-compatible-branch-for-ToT-clang.patch
deleted file mode 100644
index a623ba0..0000000
--- a/0031-Update-llvm-svn-compatible-branch-for-ToT-clang.patch
+++ /dev/null
@@ -1,784 +0,0 @@
-From d3683354d3024c78949ca3d382433586b9bff216 Mon Sep 17 00:00:00 2001
-From: Reid Kleckner <rnk@google.com>
-Date: Tue, 26 Feb 2019 15:08:05 -0800
-Subject: [PATCH 31/31] Update llvm-svn-compatible branch for ToT clang
-
-- Replace getStartLoc with getBeginLoc
-- Replace getLocEnd with getEndLoc
-- EvaluateAsInt now produces an Expr::EvalResult instead of APSInt, look
- through it
-- Misc minor fixes, const, etc
----
- clang_delta/AggregateToScalar.cpp | 2 +-
- clang_delta/ClassTemplateToClass.cpp | 2 +-
- clang_delta/CommonRenameClassRewriteVisitor.h | 6 +++---
- clang_delta/EmptyStructToInt.cpp | 6 +++---
- clang_delta/ExpressionDetector.cpp | 2 +-
- clang_delta/InstantiateTemplateParam.cpp | 2 +-
- .../InstantiateTemplateTypeParamToInt.cpp | 2 +-
- clang_delta/LocalToGlobal.cpp | 2 +-
- clang_delta/ReduceArrayDim.cpp | 6 +++---
- clang_delta/ReducePointerLevel.cpp | 2 +-
- clang_delta/RemoveNamespace.cpp | 12 +++++------
- clang_delta/RemoveNestedFunction.cpp | 8 ++++----
- clang_delta/RemoveUnusedEnumMember.cpp | 4 ++--
- clang_delta/RemoveUnusedFunction.cpp | 8 ++++----
- clang_delta/RemoveUnusedOuterClass.cpp | 2 +-
- clang_delta/RenameCXXMethod.cpp | 5 +++--
- clang_delta/RenameFun.cpp | 2 +-
- clang_delta/ReplaceCallExpr.cpp | 4 ++--
- clang_delta/ReplaceDependentTypedef.cpp | 2 +-
- clang_delta/ReplaceFunctionDefWithDecl.cpp | 2 +-
- clang_delta/ReplaceOneLevelTypedefType.cpp | 2 +-
- clang_delta/ReplaceSimpleTypedef.cpp | 6 +++---
- clang_delta/ReplaceUndefinedFunction.cpp | 2 +-
- clang_delta/RewriteUtils.cpp | 18 ++++++++---------
- clang_delta/SimpleInliner.cpp | 4 ++--
- clang_delta/SimplifyDependentTypedef.cpp | 2 +-
- clang_delta/SimplifyIf.cpp | 2 +-
- clang_delta/SimplifyNestedClass.cpp | 4 ++--
- clang_delta/SimplifyStruct.cpp | 8 ++++----
- clang_delta/TemplateNonTypeArgToInt.cpp | 6 +++---
- clang_delta/Transformation.cpp | 20 +++++++++----------
- clang_delta/VectorToArray.cpp | 2 +-
- 32 files changed, 79 insertions(+), 78 deletions(-)
-
-diff --git a/clang_delta/AggregateToScalar.cpp b/clang_delta/AggregateToScalar.cpp
-index fa0b2d8..9010c40 100644
---- a/clang_delta/AggregateToScalar.cpp
-+++ b/clang_delta/AggregateToScalar.cpp
-@@ -212,7 +212,7 @@ bool AggregateToScalar::createNewVar(const Expr *RefE, std::string &VarName)
- return addTmpVar(RefE, VarName, NULL);
-
- std::string InitStr;
-- if (InitE->getLocStart().isInvalid()) {
-+ if (InitE->getBeginLoc().isInvalid()) {
- const Type *ET = InitE->getType().getTypePtr();
- if (ET->isIntegerType() || ET->isPointerType())
- InitStr = "0";
-diff --git a/clang_delta/ClassTemplateToClass.cpp b/clang_delta/ClassTemplateToClass.cpp
-index 5ec5f12..0bba98c 100644
---- a/clang_delta/ClassTemplateToClass.cpp
-+++ b/clang_delta/ClassTemplateToClass.cpp
-@@ -247,7 +247,7 @@ void ClassTemplateToClass::rewriteClassTemplateDecls(void)
- E = TheClassTemplateDecl->redecls_end();
- I != E; ++I) {
- const TemplateParameterList *TPList = (*I)->getTemplateParameters();
-- SourceLocation LocStart = (*I)->getLocStart();
-+ SourceLocation LocStart = (*I)->getBeginLoc();
- removeTemplateAndParameter(LocStart, TPList);
- }
- }
-diff --git a/clang_delta/CommonRenameClassRewriteVisitor.h b/clang_delta/CommonRenameClassRewriteVisitor.h
-index 725b8c9..d682ce9 100644
---- a/clang_delta/CommonRenameClassRewriteVisitor.h
-+++ b/clang_delta/CommonRenameClassRewriteVisitor.h
-@@ -148,7 +148,7 @@ bool CommonRenameClassRewriteVisitor<T>::
- if (!TyInfo)
- return true;
- TypeLoc TyLoc = TyInfo->getTypeLoc();
-- SourceLocation LocStart = TyLoc.getLocStart();
-+ SourceLocation LocStart = TyLoc.getBeginLoc();
- TransAssert(LocStart.isValid() && "Invalid Location!");
- TheRewriter->ReplaceText(LocStart, CXXRD->getNameAsString().size(), Name);
- }
-@@ -267,7 +267,7 @@ bool CommonRenameClassRewriteVisitor<T>::VisitInjectedClassNameTypeLoc(
-
- std::string Name;
- if (getNewName(CXXRD, Name)) {
-- SourceLocation LocStart = TyLoc.getLocStart();
-+ SourceLocation LocStart = TyLoc.getBeginLoc();
- TransAssert(LocStart.isValid() && "Invalid Location!");
-
- TheRewriter->ReplaceText(LocStart, CXXRD->getNameAsString().size(), Name);
-@@ -313,7 +313,7 @@ bool CommonRenameClassRewriteVisitor<T>::VisitRecordTypeLoc(RecordTypeLoc RTLoc)
-
- // Avoid duplicated rewrites to Decls from the same DeclGroup, e.g.,
- // struct S s1, s2
-- SourceLocation LocStart = RTLoc.getLocStart();
-+ SourceLocation LocStart = RTLoc.getBeginLoc();
- void *LocPtr = LocStart.getPtrEncoding();
- if (VisitedLocs.count(LocPtr))
- return true;
-diff --git a/clang_delta/EmptyStructToInt.cpp b/clang_delta/EmptyStructToInt.cpp
-index ae15c8a..771e7cf 100644
---- a/clang_delta/EmptyStructToInt.cpp
-+++ b/clang_delta/EmptyStructToInt.cpp
-@@ -113,7 +113,7 @@ bool EmptyStructToIntRewriteVisitor::VisitRecordTypeLoc(RecordTypeLoc RTLoc)
- const RecordDecl *RD = RTLoc.getDecl();
-
- if (RD->getCanonicalDecl() == ConsumerInstance->TheRecordDecl) {
-- SourceLocation LocStart = RTLoc.getLocStart();
-+ SourceLocation LocStart = RTLoc.getBeginLoc();
- void *LocPtr = LocStart.getPtrEncoding();
- if (ConsumerInstance->VisitedLocs.count(LocPtr))
- return true;
-@@ -147,11 +147,11 @@ bool EmptyStructToIntRewriteVisitor::VisitElaboratedTypeLoc(
- return true;
- }
-
-- SourceLocation StartLoc = Loc.getLocStart();
-+ SourceLocation StartLoc = Loc.getBeginLoc();
- if (StartLoc.isInvalid())
- return true;
- TypeLoc TyLoc = Loc.getNamedTypeLoc();
-- SourceLocation EndLoc = TyLoc.getLocStart();
-+ SourceLocation EndLoc = TyLoc.getBeginLoc();
- if (EndLoc.isInvalid())
- return true;
- EndLoc = EndLoc.getLocWithOffset(-1);
-diff --git a/clang_delta/ExpressionDetector.cpp b/clang_delta/ExpressionDetector.cpp
-index 62d860f..533d14d 100644
---- a/clang_delta/ExpressionDetector.cpp
-+++ b/clang_delta/ExpressionDetector.cpp
-@@ -672,7 +672,7 @@ static std::string getFormatString(const BuiltinType *BT)
-
- void ExpressionDetector::doRewrite()
- {
-- SourceLocation LocStart = TheStmt->getLocStart();
-+ SourceLocation LocStart = TheStmt->getBeginLoc();
- if (shouldAddFunctionDecl(LocStart)) {
- SourceLocation Loc =
- SrcManager->getLocForStartOfFile(SrcManager->getMainFileID());
-diff --git a/clang_delta/InstantiateTemplateParam.cpp b/clang_delta/InstantiateTemplateParam.cpp
-index 8d70d22..4acdd98 100644
---- a/clang_delta/InstantiateTemplateParam.cpp
-+++ b/clang_delta/InstantiateTemplateParam.cpp
-@@ -147,7 +147,7 @@ InstantiateTemplateParamRewriteVisitor::VisitTemplateTypeParmTypeLoc(
- // the "typedef typename T2 ..." is treated as
- // typedef typename T2::template T2::C<int>::other type;
- // where the second T2 is injected by Clang
-- void *Ptr = Loc.getLocStart().getPtrEncoding();
-+ void *Ptr = Loc.getBeginLoc().getPtrEncoding();
- if (ConsumerInstance->VisitedLocs.count(Ptr))
- return true;
- ConsumerInstance->VisitedLocs.insert(Ptr);
-diff --git a/clang_delta/InstantiateTemplateTypeParamToInt.cpp b/clang_delta/InstantiateTemplateTypeParamToInt.cpp
-index d90b090..b2a3290 100644
---- a/clang_delta/InstantiateTemplateTypeParamToInt.cpp
-+++ b/clang_delta/InstantiateTemplateTypeParamToInt.cpp
-@@ -184,7 +184,7 @@ InstantiateTemplateTypeParamToIntRewriteVisitor::VisitTemplateTypeParmTypeLoc(
- if (D != ConsumerInstance->TheParameter)
- return true;
-
-- void *Ptr = Loc.getLocStart().getPtrEncoding();
-+ void *Ptr = Loc.getBeginLoc().getPtrEncoding();
- if (ConsumerInstance->VisitedLocs.count(Ptr))
- return true;
- ConsumerInstance->VisitedLocs.insert(Ptr);
-diff --git a/clang_delta/LocalToGlobal.cpp b/clang_delta/LocalToGlobal.cpp
-index 8bc4512..e08e96e 100644
---- a/clang_delta/LocalToGlobal.cpp
-+++ b/clang_delta/LocalToGlobal.cpp
-@@ -217,7 +217,7 @@ bool LToGASTVisitor::makeLocalAsGlobalVar(FunctionDecl *FD, VarDecl *VD,
-
- for (DeclContext* DC = FD; DC; DC = DC->getParent()) {
- if (DC->getParent() && DC->getParent()->isTranslationUnit()) {
-- TheRewriter.InsertTextBefore(cast<Decl>(DC)->getLocStart(), GlobalVarStr);
-+ TheRewriter.InsertTextBefore(cast<Decl>(DC)->getBeginLoc(), GlobalVarStr);
- return true;
- }
- }
-diff --git a/clang_delta/ReduceArrayDim.cpp b/clang_delta/ReduceArrayDim.cpp
-index a2f8e40..226fa41 100644
---- a/clang_delta/ReduceArrayDim.cpp
-+++ b/clang_delta/ReduceArrayDim.cpp
-@@ -249,9 +249,9 @@ unsigned ReduceArrayDim::getArraySize(const ArrayType *ATy)
- if (const DependentSizedArrayType *DepArrayTy =
- dyn_cast<DependentSizedArrayType>(ATy)) {
- const Expr *E = DepArrayTy->getSizeExpr();
-- llvm::APSInt Result;
-- if (E->EvaluateAsInt(Result, *Context)) {
-- return (unsigned)(*Result.getRawData());
-+ clang::Expr::EvalResult Result;
-+ if (E->EvaluateAsInt(Result, *Context) && Result.Val.isInt()) {
-+ return Result.Val.getInt().getZExtValue();
- }
- }
-
-diff --git a/clang_delta/ReducePointerLevel.cpp b/clang_delta/ReducePointerLevel.cpp
-index 56fb628..6b4f3dc 100644
---- a/clang_delta/ReducePointerLevel.cpp
-+++ b/clang_delta/ReducePointerLevel.cpp
-@@ -947,7 +947,7 @@ void ReducePointerLevel::replaceArrowWithDot(const Expr *E)
- {
- std::string ES;
- RewriteHelper->getExprString(E, ES);
-- SourceLocation LocStart = E->getLocStart();
-+ SourceLocation LocStart = E->getBeginLoc();
-
- size_t ArrowPos = ES.find("->");
- TransAssert((ArrowPos != std::string::npos) && "Cannot find Arrow!");
-diff --git a/clang_delta/RemoveNamespace.cpp b/clang_delta/RemoveNamespace.cpp
-index 4c97de1..a834fcf 100644
---- a/clang_delta/RemoveNamespace.cpp
-+++ b/clang_delta/RemoveNamespace.cpp
-@@ -352,7 +352,7 @@ bool RemoveNamespaceRewriteVisitor::VisitDeclRefExpr(DeclRefExpr *DRE)
- isa<EnumConstantDecl>(OrigDecl)) {
- std::string Name;
- if (ConsumerInstance->getNewName(OrigDecl, Name)) {
-- ConsumerInstance->TheRewriter.ReplaceText(DRE->getLocStart(),
-+ ConsumerInstance->TheRewriter.ReplaceText(DRE->getBeginLoc(),
- OrigDecl->getNameAsString().size(), Name);
- }
- }
-@@ -436,7 +436,7 @@ bool RemoveNamespaceRewriteVisitor::VisitClassTemplatePartialSpecializationDecl(
- if (!TyInfo)
- return true;
- TypeLoc TyLoc = TyInfo->getTypeLoc();
-- SourceLocation LocStart = TyLoc.getLocStart();
-+ SourceLocation LocStart = TyLoc.getBeginLoc();
- TransAssert(LocStart.isValid() && "Invalid Location!");
- ConsumerInstance->TheRewriter.ReplaceText(
- LocStart, CXXRD->getNameAsString().size(), Name);
-@@ -494,7 +494,7 @@ bool RemoveNamespaceRewriteVisitor::VisitInjectedClassNameTypeLoc(
-
- std::string Name;
- if (ConsumerInstance->getNewName(CXXRD, Name)) {
-- SourceLocation LocStart = TyLoc.getLocStart();
-+ SourceLocation LocStart = TyLoc.getBeginLoc();
- TransAssert(LocStart.isValid() && "Invalid Location!");
-
- ConsumerInstance->TheRewriter.ReplaceText(
-@@ -509,7 +509,7 @@ bool RemoveNamespaceRewriteVisitor::VisitTypedefTypeLoc(TypedefTypeLoc TyLoc)
-
- std::string Name;
- if (ConsumerInstance->getNewName(D, Name)) {
-- SourceLocation LocStart = TyLoc.getLocStart();
-+ SourceLocation LocStart = TyLoc.getBeginLoc();
- ConsumerInstance->TheRewriter.ReplaceText(
- LocStart, D->getNameAsString().size(), Name);
- }
-@@ -522,7 +522,7 @@ bool RemoveNamespaceRewriteVisitor::VisitEnumTypeLoc(EnumTypeLoc TyLoc)
-
- std::string Name;
- if (ConsumerInstance->getNewName(D, Name)) {
-- SourceLocation LocStart = TyLoc.getLocStart();
-+ SourceLocation LocStart = TyLoc.getBeginLoc();
- ConsumerInstance->TheRewriter.ReplaceText(
- LocStart, D->getNameAsString().size(), Name);
- }
-@@ -1006,7 +1006,7 @@ void RemoveNamespace::removeNamespace(const NamespaceDecl *ND)
- TheRewriter.RemoveText(StartLoc, 1);
-
- // Then remove name and the left brace
-- StartLoc = ND->getLocStart();
-+ StartLoc = ND->getBeginLoc();
- TransAssert(StartLoc.isValid() && "Invalid Namespace LocStart!");
-
- const char *StartBuf = SrcManager->getCharacterData(StartLoc);
-diff --git a/clang_delta/RemoveNestedFunction.cpp b/clang_delta/RemoveNestedFunction.cpp
-index 01d3850..6fd29e0 100644
---- a/clang_delta/RemoveNestedFunction.cpp
-+++ b/clang_delta/RemoveNestedFunction.cpp
-@@ -233,7 +233,7 @@ void RemoveNestedFunction::addNewTmpVariable(ASTContext &ASTCtx)
- // Otherwise, we would end up with assertion failure, because we
- // modify the same location twice (through addnewAssignStmtBefore
- // and replaceExpr.
-- if (TheStmt->getLocStart() == TheCallExpr->getLocStart()) {
-+ if (TheStmt->getBeginLoc() == TheCallExpr->getBeginLoc()) {
- std::string ExprStr;
- RewriteHelper->getExprString(TheCallExpr, ExprStr);
- VarStr += " = " + ExprStr + ";\n" + TmpVarName;
-@@ -306,7 +306,7 @@ void RemoveNestedFunction::getNewTmpVariableStr(ASTContext &ASTCtx,
-
- if (const UnresolvedMemberExpr *UM = dyn_cast<UnresolvedMemberExpr>(E)) {
- DeclarationName DName = UM->getMemberName();
-- CXXRecordDecl *CXXRD = UM->getNamingClass();
-+ const CXXRecordDecl *CXXRD = UM->getNamingClass();
- DeclContextSet VisitedCtxs;
- const FunctionDecl *FD = lookupFunctionDecl(DName, CXXRD, VisitedCtxs);
- // FIXME: try to resolve FD here
-@@ -318,14 +318,14 @@ void RemoveNestedFunction::getNewTmpVariableStr(ASTContext &ASTCtx,
- if (const CXXTemporaryObjectExpr *CXXTE =
- dyn_cast<CXXTemporaryObjectExpr>(E)) {
- const CXXConstructorDecl *CXXCtor = CXXTE->getConstructor();
-- QT = CXXCtor->getThisType(ASTCtx);
-+ QT = CXXCtor->getThisType();
- return getNewTmpVariable(QT, VarStr);
- }
-
- if (const CXXTemporaryObjectExpr *CXXTE =
- dyn_cast<CXXTemporaryObjectExpr>(E)) {
- const CXXConstructorDecl *CXXCtor = CXXTE->getConstructor();
-- QT = CXXCtor->getThisType(ASTCtx);
-+ QT = CXXCtor->getThisType();
- return getNewTmpVariable(QT, VarStr);
- }
-
-diff --git a/clang_delta/RemoveUnusedEnumMember.cpp b/clang_delta/RemoveUnusedEnumMember.cpp
-index fbce87a..b4eba8f 100644
---- a/clang_delta/RemoveUnusedEnumMember.cpp
-+++ b/clang_delta/RemoveUnusedEnumMember.cpp
-@@ -97,12 +97,12 @@ void RemoveUnusedEnumMember::HandleTranslationUnit(ASTContext &Ctx)
-
- void RemoveUnusedEnumMember::removeEnumConstantDecl()
- {
-- SourceLocation StartLoc = (*TheEnumIterator)->getLocStart();
-+ SourceLocation StartLoc = (*TheEnumIterator)->getBeginLoc();
- if (StartLoc.isMacroID()) {
- CharSourceRange Range = SrcManager->getExpansionRange(StartLoc);
- StartLoc = Range.getBegin();
- }
-- SourceLocation EndLoc = (*TheEnumIterator)->getLocEnd();
-+ SourceLocation EndLoc = (*TheEnumIterator)->getEndLoc();
- if (EndLoc.isMacroID()) {
- CharSourceRange Range = SrcManager->getExpansionRange(EndLoc);
- EndLoc = Range.getEnd();
-diff --git a/clang_delta/RemoveUnusedFunction.cpp b/clang_delta/RemoveUnusedFunction.cpp
-index 747aac1..f8b19b9 100644
---- a/clang_delta/RemoveUnusedFunction.cpp
-+++ b/clang_delta/RemoveUnusedFunction.cpp
-@@ -387,19 +387,19 @@ bool RemoveUnusedFunction::hasValidOuterLocStart(
- SourceLocation RemoveUnusedFunction::getFunctionOuterLocStart(
- const FunctionDecl *FD)
- {
-- SourceLocation LocStart = FD->getLocStart();
-+ SourceLocation LocStart = FD->getBeginLoc();
- 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,
-+ // get FTD->getBeginLoc() only if it is less than FD->getBeginLoc,
- // for example, in the code below:
- // template <typename T> struct S {template <typename T1> void foo();};
- // template<typename T> template<typename T1> void S<T>::foo() { }
- // where
-- // FTD->getLocStart() points to the begining of "template<typename T1>"
-+ // FTD->getBeginLoc() points to the begining of "template<typename T1>"
- if (hasValidOuterLocStart(FTD, FD)) {
-- LocStart = FTD->getLocStart();
-+ LocStart = FTD->getBeginLoc();
- RecordLoc = true;
- }
- }
-diff --git a/clang_delta/RemoveUnusedOuterClass.cpp b/clang_delta/RemoveUnusedOuterClass.cpp
-index 2e5f731..e2393a9 100644
---- a/clang_delta/RemoveUnusedOuterClass.cpp
-+++ b/clang_delta/RemoveUnusedOuterClass.cpp
-@@ -122,7 +122,7 @@ void RemoveUnusedOuterClass::analyzeCXXRDSet()
- void RemoveUnusedOuterClass::removeOuterClass()
- {
- TransAssert(TheCXXRDDef && "NULL Base CXXRD!");
-- SourceLocation LocStart = TheCXXRDDef->getLocStart();
-+ SourceLocation LocStart = TheCXXRDDef->getBeginLoc();
- SourceLocation LocEnd =
- RewriteHelper->getEndLocationUntil(LocStart, '{');
- TransAssert(LocEnd.isValid() && "Invalid Location!");
-diff --git a/clang_delta/RenameCXXMethod.cpp b/clang_delta/RenameCXXMethod.cpp
-index 1f7132b..be98d37 100644
---- a/clang_delta/RenameCXXMethod.cpp
-+++ b/clang_delta/RenameCXXMethod.cpp
-@@ -252,7 +252,7 @@ bool RenameCXXMethodVisitor::VisitDeclRefExpr(DeclRefExpr *DRE)
- &QualLoc, MD, NewName);
- }
- else {
-- ConsumerInstance->TheRewriter.ReplaceText(DRE->getLocStart(),
-+ ConsumerInstance->TheRewriter.ReplaceText(DRE->getBeginLoc(),
- MD->getNameAsString().size(), NewName);
- }
-
-@@ -534,7 +534,8 @@ bool RenameCXXMethod::isSpecialCXXMethod(const CXXMethodDecl *MD)
- dyn_cast<CXXConversionDecl>(MD))
- return true;
-
-- if (MD->isUsualDeallocationFunction() ||
-+ SmallVector<const FunctionDecl*, 1> DeallocPrevented;
-+ if (MD->isUsualDeallocationFunction(DeallocPrevented) ||
- MD->isCopyAssignmentOperator() ||
- MD->isMoveAssignmentOperator() ||
- MD->isLambdaStaticInvoker() ||
-diff --git a/clang_delta/RenameFun.cpp b/clang_delta/RenameFun.cpp
-index ee7ba28..a7deaf3 100644
---- a/clang_delta/RenameFun.cpp
-+++ b/clang_delta/RenameFun.cpp
-@@ -145,7 +145,7 @@ bool RenameFunVisitor::VisitDeclRefExpr(DeclRefExpr *DRE)
-
- TransAssert((I != ConsumerInstance->FunToNameMap.end()) &&
- "Cannot find FunctionDecl!");
-- ConsumerInstance->TheRewriter.ReplaceText(DRE->getLocStart(),
-+ ConsumerInstance->TheRewriter.ReplaceText(DRE->getBeginLoc(),
- FD->getNameAsString().size(), (*I).second);
- return true;
- }
-diff --git a/clang_delta/ReplaceCallExpr.cpp b/clang_delta/ReplaceCallExpr.cpp
-index 7d912cd..b6bebe9 100644
---- a/clang_delta/ReplaceCallExpr.cpp
-+++ b/clang_delta/ReplaceCallExpr.cpp
-@@ -538,7 +538,7 @@ void ReplaceCallExpr::sortParmRefsByOffs(const char *StartBuf,
- I = ParmRefToStrMap.begin(), E = ParmRefToStrMap.end(); I != E; ++I) {
-
- const DeclRefExpr *ParmRef = (*I).first;
-- SourceLocation ParmRefLocStart = ParmRef->getLocStart();
-+ SourceLocation ParmRefLocStart = ParmRef->getBeginLoc();
- const char *ParmRefStartBuf =
- SrcManager->getCharacterData(ParmRefLocStart);
-
-@@ -551,7 +551,7 @@ void ReplaceCallExpr::sortParmRefsByOffs(const char *StartBuf,
- void ReplaceCallExpr::replaceParmRefs(std::string &RetStr, const Expr *RetE,
- llvm::DenseMap<const DeclRefExpr *, std::string> &ParmRefToStrMap)
- {
-- SourceLocation StartLoc = RetE->getLocStart();
-+ SourceLocation StartLoc = RetE->getBeginLoc();
- const char *StartBuf = SrcManager->getCharacterData(StartLoc);
-
- std::vector< std::pair<const DeclRefExpr *, int> > SortedParmRefs;
-diff --git a/clang_delta/ReplaceDependentTypedef.cpp b/clang_delta/ReplaceDependentTypedef.cpp
-index a0408a6..fe2541d 100644
---- a/clang_delta/ReplaceDependentTypedef.cpp
-+++ b/clang_delta/ReplaceDependentTypedef.cpp
-@@ -127,7 +127,7 @@ bool ReplaceDependentTypedef::isValidType(const QualType &QT)
-
- void ReplaceDependentTypedef::handleOneTypedefDecl(const TypedefDecl *D)
- {
-- if (isInIncludedFile(D) || D->getLocStart().isInvalid())
-+ if (isInIncludedFile(D) || D->getBeginLoc().isInvalid())
- return;
-
- if (!isValidType(D->getUnderlyingType()))
-diff --git a/clang_delta/ReplaceFunctionDefWithDecl.cpp b/clang_delta/ReplaceFunctionDefWithDecl.cpp
-index c835c6f..c7a8460 100644
---- a/clang_delta/ReplaceFunctionDefWithDecl.cpp
-+++ b/clang_delta/ReplaceFunctionDefWithDecl.cpp
-@@ -323,7 +323,7 @@ bool ReplaceFunctionDefWithDecl::isMacroExpansion(const FunctionDecl *FD)
- const Stmt *Body = FD->getBody();
- if (!Body)
- return false;
-- return SrcManager->isMacroBodyExpansion(Body->getLocStart());
-+ return SrcManager->isMacroBodyExpansion(Body->getBeginLoc());
- }
-
- void ReplaceFunctionDefWithDecl::addOneFunctionDef(const FunctionDecl *FD)
-diff --git a/clang_delta/ReplaceOneLevelTypedefType.cpp b/clang_delta/ReplaceOneLevelTypedefType.cpp
-index 75f0e92..bf55f12 100644
---- a/clang_delta/ReplaceOneLevelTypedefType.cpp
-+++ b/clang_delta/ReplaceOneLevelTypedefType.cpp
-@@ -123,7 +123,7 @@ void ReplaceOneLevelTypedefType::handleOneTypedefTypeLoc(TypedefTypeLoc TLoc)
- return;
- const TypedefType *TdefTy = TLoc.getTypePtr();
- const TypedefDecl *TdefD = dyn_cast<TypedefDecl>(TdefTy->getDecl());
-- if (!TdefD || TdefD->getLocStart().isInvalid())
-+ if (!TdefD || TdefD->getBeginLoc().isInvalid())
- return;
- const TypedefDecl *CanonicalD =
- dyn_cast<TypedefDecl>(TdefD->getCanonicalDecl());
-diff --git a/clang_delta/ReplaceSimpleTypedef.cpp b/clang_delta/ReplaceSimpleTypedef.cpp
-index 7c9db0c..602399e 100644
---- a/clang_delta/ReplaceSimpleTypedef.cpp
-+++ b/clang_delta/ReplaceSimpleTypedef.cpp
-@@ -85,7 +85,7 @@ bool ReplaceSimpleTypedefRewriteVisitor::VisitTypedefTypeLoc(TypedefTypeLoc Loc)
-
- const TypedefType *TdefTy = Loc.getTypePtr();
- const TypedefDecl *TdefD = dyn_cast<TypedefDecl>(TdefTy->getDecl());
-- if (!TdefD || TdefD->getLocStart().isInvalid())
-+ if (!TdefD || TdefD->getBeginLoc().isInvalid())
- return true;
-
- if (dyn_cast<TypedefDecl>(TdefD->getCanonicalDecl()) ==
-@@ -203,10 +203,10 @@ bool ReplaceSimpleTypedef::isValidType(const Type *Ty, const TypedefDecl *D)
- void ReplaceSimpleTypedef::handleOneTypedefDecl(const TypedefDecl *CanonicalD)
- {
- // omit some typedefs injected by Clang
-- if (CanonicalD->getLocStart().isInvalid())
-+ if (CanonicalD->getBeginLoc().isInvalid())
- return;
-
-- FullSourceLoc FullLoc = Context->getFullLoc(CanonicalD->getLocStart());
-+ FullSourceLoc FullLoc = Context->getFullLoc(CanonicalD->getBeginLoc());
- if (FullLoc.isInSystemHeader())
- return;
-
-diff --git a/clang_delta/ReplaceUndefinedFunction.cpp b/clang_delta/ReplaceUndefinedFunction.cpp
-index d6b6439..4c6bba9 100644
---- a/clang_delta/ReplaceUndefinedFunction.cpp
-+++ b/clang_delta/ReplaceUndefinedFunction.cpp
-@@ -90,7 +90,7 @@ bool ReplaceUndefFuncRewriteVisitor::VisitCallExpr(CallExpr *CE)
- return true;
-
- if (FD->getCanonicalDecl() == ConsumerInstance->ReplacedFunctionDecl) {
-- ConsumerInstance->TheRewriter.ReplaceText(CE->getLocStart(),
-+ ConsumerInstance->TheRewriter.ReplaceText(CE->getBeginLoc(),
- ConsumerInstance->ReplacedFunctionDecl->getNameAsString().size(),
- ConsumerInstance->ReplacingFunctionDecl->getNameAsString());
- }
-diff --git a/clang_delta/RewriteUtils.cpp b/clang_delta/RewriteUtils.cpp
-index 1adde91..3a1fa19 100644
---- a/clang_delta/RewriteUtils.cpp
-+++ b/clang_delta/RewriteUtils.cpp
-@@ -455,7 +455,7 @@ SourceLocation RewriteUtils::getVarDeclTypeLocBegin(const VarDecl *VD)
- NextTL = NextTL.getNextTypeLoc();
- }
-
-- return VarTypeLoc.getLocStart();
-+ return VarTypeLoc.getBeginLoc();
- }
-
- SourceLocation RewriteUtils::getVarDeclTypeLocEnd(const VarDecl *VD)
-@@ -705,7 +705,7 @@ bool RewriteUtils::replaceExprNotInclude(const Expr *E,
- std::string RewriteUtils::getStmtIndentString(Stmt *S,
- SourceManager *SrcManager)
- {
-- SourceLocation StmtStartLoc = S->getLocStart();
-+ SourceLocation StmtStartLoc = S->getBeginLoc();
-
- if (StmtStartLoc.isMacroID()) {
- StmtStartLoc = SrcManager->getFileLoc(StmtStartLoc);
-@@ -748,7 +748,7 @@ bool RewriteUtils::addLocalVarToFunc(const std::string &VarStr,
- IndentStr = getStmtIndentString((*I), SrcManager);
-
- std::string NewVarStr = "\n" + IndentStr + VarStr;
-- SourceLocation StartLoc = Body->getLocStart();
-+ SourceLocation StartLoc = Body->getBeginLoc();
- return !(TheRewriter->InsertTextAfterToken(StartLoc, NewVarStr));
- }
-
-@@ -776,7 +776,7 @@ bool RewriteUtils::addNewAssignStmtBefore(Stmt *BeforeStmt,
- return false;
- }
-
-- SourceLocation StmtLocStart = BeforeStmt->getLocStart();
-+ SourceLocation StmtLocStart = BeforeStmt->getBeginLoc();
- if (StmtLocStart.isMacroID()) {
- StmtLocStart = SrcManager->getFileLoc(StmtLocStart);
- }
-@@ -842,7 +842,7 @@ bool RewriteUtils::addStringBeforeStmtInternal(Stmt *S,
- std::string IndentedStr;
- indentAfterNewLine(NewStr, IndentedStr, IndentStr);
-
-- return !(TheRewriter->InsertText(S->getLocStart(),
-+ return !(TheRewriter->InsertText(S->getBeginLoc(),
- IndentedStr, /*InsertAfter=*/false));
- }
-
-@@ -1164,7 +1164,7 @@ bool RewriteUtils::getDeclGroupStrAndRemove(DeclGroupRef DGR,
- SourceLocation LastEndLoc = getEndLocationUntil(LastVarRange, ';');
- getStringBetweenLocs(Str, TypeLocEnd, LastEndLoc);
-
-- SourceLocation StartLoc = FirstVD->getLocStart();
-+ SourceLocation StartLoc = FirstVD->getBeginLoc();
- SourceLocation NewLastEndLoc = getLocationAfterSkiping(LastEndLoc, ';');
- return !(TheRewriter->RemoveText(SourceRange(StartLoc, NewLastEndLoc)));
- }
-@@ -1421,7 +1421,7 @@ bool RewriteUtils::removeIfAndCond(const IfStmt *IS)
- const Stmt *ThenStmt = IS->getThen();
- TransAssert(ThenStmt && "NULL ThenStmt!");
-
-- SourceLocation ThenLoc = ThenStmt->getLocStart();
-+ SourceLocation ThenLoc = ThenStmt->getBeginLoc();
- SourceLocation EndLoc = ThenLoc.getLocWithOffset(-1);
-
- Rewriter::RewriteOptions Opts;
-@@ -1546,7 +1546,7 @@ bool RewriteUtils::replaceCXXDtorCallExpr(const CXXMemberCallExpr *CE,
- if (Pos == 0)
- return true;
-
-- SourceLocation StartLoc = CE->getLocStart();
-+ SourceLocation StartLoc = CE->getBeginLoc();
- StartLoc = StartLoc.getLocWithOffset(Pos);
-
- return !(TheRewriter->ReplaceText(StartLoc, OldDtorName.size(), Name));
-@@ -1615,7 +1615,7 @@ bool RewriteUtils::replaceRecordType(RecordTypeLoc &RTLoc,
- if (!TypeId)
- return true;
-
-- SourceLocation LocStart = RTLoc.getLocStart();
-+ SourceLocation LocStart = RTLoc.getBeginLoc();
-
- // Loc could be invalid, for example:
- // class AAA { };
-diff --git a/clang_delta/SimpleInliner.cpp b/clang_delta/SimpleInliner.cpp
-index 8728dcc..a93e982 100644
---- a/clang_delta/SimpleInliner.cpp
-+++ b/clang_delta/SimpleInliner.cpp
-@@ -487,7 +487,7 @@ void SimpleInliner::sortReturnStmtsByOffs(const char *StartBuf,
- for (ReturnStmtsVector::iterator I = ReturnStmts.begin(),
- E = ReturnStmts.end(); I != E; ++I) {
- ReturnStmt *RS = (*I);
-- SourceLocation RSLocStart = RS->getLocStart();
-+ SourceLocation RSLocStart = RS->getBeginLoc();
- const char *RSStartBuf = SrcManager->getCharacterData(RSLocStart);
- int Off = RSStartBuf - StartBuf;
- TransAssert((Off >= 0) && "Bad Offset!");
-@@ -504,7 +504,7 @@ void SimpleInliner::copyFunctionBody(void)
- RewriteHelper->getStmtString(Body, FuncBodyStr);
- TransAssert(FuncBodyStr[0] == '{');
-
-- SourceLocation StartLoc = Body->getLocStart();
-+ SourceLocation StartLoc = Body->getBeginLoc();
- const char *StartBuf = SrcManager->getCharacterData(StartLoc);
-
- std::vector< std::pair<ReturnStmt *, int> > SortedReturnStmts;
-diff --git a/clang_delta/SimplifyDependentTypedef.cpp b/clang_delta/SimplifyDependentTypedef.cpp
-index 7d2a8c7..4a0dceb 100644
---- a/clang_delta/SimplifyDependentTypedef.cpp
-+++ b/clang_delta/SimplifyDependentTypedef.cpp
-@@ -140,7 +140,7 @@ void SimplifyDependentTypedef::HandleTranslationUnit(ASTContext &Ctx)
-
- void SimplifyDependentTypedef::rewriteTypedefDecl(void)
- {
-- SourceLocation LocStart = TheTypedefDecl->getLocStart();
-+ SourceLocation LocStart = TheTypedefDecl->getBeginLoc();
-
- // skip "typedef "
- LocStart = LocStart.getLocWithOffset(8);
-diff --git a/clang_delta/SimplifyIf.cpp b/clang_delta/SimplifyIf.cpp
-index 9f9982c..770cc7a 100644
---- a/clang_delta/SimplifyIf.cpp
-+++ b/clang_delta/SimplifyIf.cpp
-@@ -95,7 +95,7 @@ bool SimplifyIfCollectionVisitor::VisitFunctionDecl(FunctionDecl *FD)
- // foo(bar())
- bool SimplifyIfStatementVisitor::VisitIfStmt(IfStmt *IS)
- {
-- if (IS->getLocStart().isMacroID()) {
-+ if (IS->getBeginLoc().isMacroID()) {
- return false;
- }
-
-diff --git a/clang_delta/SimplifyNestedClass.cpp b/clang_delta/SimplifyNestedClass.cpp
-index 1bd6702..624e0fb 100644
---- a/clang_delta/SimplifyNestedClass.cpp
-+++ b/clang_delta/SimplifyNestedClass.cpp
-@@ -134,8 +134,8 @@ void SimplifyNestedClass::HandleTranslationUnit(ASTContext &Ctx)
- void SimplifyNestedClass::removeOuterClass()
- {
- TransAssert(TheBaseCXXRD && "NULL Base CXXRD!");
-- SourceLocation LocStart = TheBaseCXXRD->getLocStart();
-- SourceLocation LocEnd = TheInnerDecl->getLocStart();
-+ SourceLocation LocStart = TheBaseCXXRD->getBeginLoc();
-+ SourceLocation LocEnd = TheInnerDecl->getBeginLoc();
- LocEnd = LocEnd.getLocWithOffset(-1);
- TheRewriter.RemoveText(SourceRange(LocStart, LocEnd));
-
-diff --git a/clang_delta/SimplifyStruct.cpp b/clang_delta/SimplifyStruct.cpp
-index 506ac35..74f24a5 100644
---- a/clang_delta/SimplifyStruct.cpp
-+++ b/clang_delta/SimplifyStruct.cpp
-@@ -130,7 +130,7 @@ bool SimplifyStructRewriteVisitor::VisitVarDecl(VarDecl *VD)
- if (RD != ConsumerInstance->TheRecordDecl)
- return true;
-
-- SourceLocation LocStart = VD->getLocStart();
-+ SourceLocation LocStart = VD->getBeginLoc();
- void *LocPtr = LocStart.getPtrEncoding();
- if (ConsumerInstance->VisitedVarDeclLocs.count(LocPtr))
- return true;
-@@ -187,7 +187,7 @@ bool SimplifyStructRewriteVisitor::VisitRecordTypeLoc(RecordTypeLoc RTLoc)
- if (CanonicalRD != ConsumerInstance->TheRecordDecl)
- return true;
-
-- SourceLocation LocStart = RTLoc.getLocStart();
-+ SourceLocation LocStart = RTLoc.getBeginLoc();
- void *LocPtr = LocStart.getPtrEncoding();
- if (ConsumerInstance->VisitedLocs.count(LocPtr))
- return true;
-@@ -224,7 +224,7 @@ bool SimplifyStructRewriteVisitor::VisitMemberExpr(MemberExpr *ME)
- TransAssert((ReplacingRD == ConsumerInstance->ReplacingRecordDecl) &&
- "Unmatched Replacing RD!");
-
-- SourceLocation LocEnd = ME->getLocEnd();
-+ SourceLocation LocEnd = ME->getEndLoc();
- if (LocEnd.isMacroID()) {
- LocEnd = ConsumerInstance->SrcManager->getSpellingLoc(LocEnd);
- }
-@@ -246,7 +246,7 @@ bool SimplifyStructRewriteVisitor::VisitMemberExpr(MemberExpr *ME)
-
- // no more MemberExpr upon this ME
- if (ArrowPos.isInvalid() && PeriodPos.isInvalid()) {
-- SourceLocation StartLoc = ME->getLocStart();
-+ SourceLocation StartLoc = ME->getBeginLoc();
- size_t Pos;
-
- if (ME->isArrow()) {
-diff --git a/clang_delta/TemplateNonTypeArgToInt.cpp b/clang_delta/TemplateNonTypeArgToInt.cpp
-index e887196..ee20379 100644
---- a/clang_delta/TemplateNonTypeArgToInt.cpp
-+++ b/clang_delta/TemplateNonTypeArgToInt.cpp
-@@ -163,10 +163,10 @@ void TemplateNonTypeArgToInt::handleOneTemplateArgumentLoc(
- ValidInstanceNum++;
- if (ValidInstanceNum == TransformationCounter) {
- TheExpr = ArgLoc.getLocInfo().getAsExpr();
-- llvm::APSInt Result;
-+ clang::Expr::EvalResult Result;
- if (!TheExpr->isValueDependent() &&
-- TheExpr->EvaluateAsInt(Result, *Context)) {
-- IntString = Result.toString(10);
-+ TheExpr->EvaluateAsInt(Result, *Context) && Result.Val.isInt()) {
-+ IntString = Result.Val.getInt().toString(10);
- }
- }
- }
-diff --git a/clang_delta/Transformation.cpp b/clang_delta/Transformation.cpp
-index 9fa9cb1..026cdd9 100644
---- a/clang_delta/Transformation.cpp
-+++ b/clang_delta/Transformation.cpp
-@@ -212,10 +212,10 @@ const Expr *Transformation::getArrayBaseExprAndIdxs(
- while (ASE) {
- const Expr *IdxE = ASE->getIdx();
- unsigned int Idx = 0;
-- llvm::APSInt Result;
-- if (IdxE && IdxE->EvaluateAsInt(Result, *Context)) {
-+ clang::Expr::EvalResult Result;
-+ if (IdxE && IdxE->EvaluateAsInt(Result, *Context) && Result.Val.isInt()) {
- // this will truncate a possible uint64 value to uint32 value
-- Idx = (unsigned int)(*Result.getRawData());
-+ Idx = Result.Val.getInt().getZExtValue();
- }
- BaseE = ASE->getBase()->IgnoreParenCasts();
- ASE = dyn_cast<ArraySubscriptExpr>(BaseE);
-@@ -389,11 +389,11 @@ const Expr *Transformation::getBaseExprAndIdxs(const Expr *E,
- const ArraySubscriptExpr *ASE = dyn_cast<ArraySubscriptExpr>(E);
- const Expr *IdxE = ASE->getIdx();
- unsigned int Idx = 0;
-- llvm::APSInt Result;
-+ clang::Expr::EvalResult Result;
-
- // If we cannot have an integeral index, use 0.
-- if (IdxE && IdxE->EvaluateAsInt(Result, *Context)) {
-- std::string IntStr = Result.toString(10);
-+ if (IdxE && IdxE->EvaluateAsInt(Result, *Context) && Result.Val.isInt()) {
-+ std::string IntStr = Result.Val.getInt().toString(10);
- std::stringstream TmpSS(IntStr);
- if (!(TmpSS >> Idx))
- TransAssert(0 && "Non-integer value!");
-@@ -434,12 +434,12 @@ const Type *Transformation::getBasePointerElemType(const Type *Ty)
-
- int Transformation::getIndexAsInteger(const Expr *E)
- {
-- llvm::APSInt Result;
-+ clang::Expr::EvalResult Result;
- int Idx;
-- if (!E->EvaluateAsInt(Result, *Context))
-+ if (!E->EvaluateAsInt(Result, *Context) || !Result.Val.isInt())
- TransAssert(0 && "Failed to Evaluate index!");
-
-- Idx = (int)(*Result.getRawData());
-+ Idx = (int)Result.Val.getInt().getSExtValue();
- return Idx;
- }
-
-@@ -1073,7 +1073,7 @@ bool Transformation::isInIncludedFile(const Decl *D) const
-
- bool Transformation::isInIncludedFile(const Stmt *S) const
- {
-- return isInIncludedFile(S->getLocStart());
-+ return isInIncludedFile(S->getBeginLoc());
- }
-
- bool Transformation::isDeclaringRecordDecl(const RecordDecl *RD)
-diff --git a/clang_delta/VectorToArray.cpp b/clang_delta/VectorToArray.cpp
-index 3ca221b..8d6c0c1 100644
---- a/clang_delta/VectorToArray.cpp
-+++ b/clang_delta/VectorToArray.cpp
-@@ -129,7 +129,7 @@ public:
- unsigned NameLength = IdInfo->getLength();
- assert(NameLength && "Variable name has no length");
-
-- SourceLocation TypeLocStart = VD->getLocStart();
-+ SourceLocation TypeLocStart = VD->getBeginLoc();
- const std::string ElemTypeName = getVectorElemTypeName(VD);
-
- SourceLocation NameLocM1 = NameLoc.getLocWithOffset(-1);
---
-2.21.0
-
diff --git a/creduce.spec b/creduce.spec
index 307423b..3f2c53d 100644
--- a/creduce.spec
+++ b/creduce.spec
@@ -1,12 +1,12 @@
%define git %nil
Name: creduce
-Version: 2.8.0
+Version: 2.10.0
%if 0%{git}
Release: 0.%{git}.1
Source0: %{name}-%{git}.tar.xz
%else
-Release: 3
+Release: 1
Source0: http://embed.cs.utah.edu/creduce/%{name}-%{version}.tar.gz
%endif
Summary: Tool for creating reduced test cases for compiler bugs
@@ -26,38 +26,6 @@ Requires: flex
Requires: astyle
Requires: indent
Requires: delta
-# From llvm-svn-compatible branch
-Patch100: 0001-Fixes-140-Support-version-flag.patch
-Patch101: 0002-Increment-version-number-to-2.9.0.patch
-Patch102: 0003-Fix-option-name.patch
-Patch103: 0004-Handle-DependentScopeDeclRefExpr.patch
-Patch104: 0005-Iterate-a-CXXRecordDecl-only-if-it-has-definition.patch
-Patch105: 0006-Check-number-of-CPUs-only-if-n-wasn-t-specified.patch
-Patch106: 0007-Fix-typo.patch
-Patch107: 0008-Handle-non-constant-array-types.patch
-Patch108: 0009-Fixed-an-issue-for-rewriting-record-decls.patch
-Patch109: 0010-Allow-tests-with-.cc-postfix.patch
-Patch110: 0011-Added-a-new-test.patch
-Patch111: 0012-Fixed-issues-for-empty-struct-to-int.patch
-Patch112: 0013-avoid-overwritting-destructors-when-renaming-classes.patch
-Patch113: 0014-Fixed-an-issue-for-empty-struct-to-int.patch
-Patch114: 0015-Use-a-different-name-for-the-sub-loop.patch
-Patch115: 0016-make-InclusionDirective-virtual.patch
-Patch116: 0017-Fixed-a-Wreturn-type-warning.patch
-Patch117: 0018-Fixed-a-crash-for-removing-explicit-instantiation.patch
-Patch118: 0019-avoid-removing-nested-calls-from-member-initializers.patch
-Patch119: 0020-Update-RemoveUnusedEnumMember.h.patch
-Patch120: 0021-Update-include-guard.patch
-Patch121: 0022-take-syntactic-form-only-if-it-s-non-null.patch
-Patch122: 0023-built-with-LLVM-7.0.patch
-Patch123: 0024-change-ordering-so-pass_includes-is-called-after-pas.patch
-Patch124: 0025-add-pass-to-remove-constant-ifs.patch
-Patch125: 0026-add-pass-for-line-markers.patch
-Patch126: 0027-add-binary-search-removal-of-c-style-comments.patch
-Patch127: 0028-convert-to-markdown.patch
-Patch128: 0029-patch-from-Mingwandroid-to-update-to-LLVM-7.patch
-Patch129: 0030-skip-inlining-calls-in-default-arguments.patch
-Patch130: 0031-Update-llvm-svn-compatible-branch-for-ToT-clang.patch
%description
C-Reduce is a tool that takes a large C or C++ program that has a
@@ -70,7 +38,7 @@ report bugs in compilers and other tools that process C/C++ code.
%if 0%{git}
%autosetup -p1 -n %{name}-%{name}-%{version}
%else
-%autosetup -p1 -n %{name}-%{name}-%{version}
+%autosetup -p1 -n %{name}-%{version}
%endif
%build