summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/Refactoring/AtomicChange.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-09-14 10:06:52 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-09-14 10:06:52 +0000
commitb54ef6a2a4c84293f64f90ea344b129eabbb0cd1 (patch)
treebeea03e3a80eaf8bc338ebb66b247f3363562975 /clang/lib/Tooling/Refactoring/AtomicChange.cpp
parentd7b3add7c4a25a558794bf1c1ca30f865b8c6dd7 (diff)
downloadbcm5719-llvm-b54ef6a2a4c84293f64f90ea344b129eabbb0cd1.tar.gz
bcm5719-llvm-b54ef6a2a4c84293f64f90ea344b129eabbb0cd1.zip
[refactor] add clang-refactor tool with initial testing support and
local-rename action This commit introduces the clang-refactor tool alongside the local-rename action which uses the existing renaming engine used by clang-rename. The tool doesn't actually perform the source transformations yet, it just provides testing support. This commit also moves only one test from clang-rename over to test/Refactor. I will continue to move the other tests throughout development of clang-refactor. The following options are supported by clang-refactor: -v: use verbose output -selection: The source range that corresponds to the portion of the source that's selected (currently only special command test:<file> is supported). Please note that a follow-up commit will migrate clang-refactor to libTooling's common option parser, so clang-refactor will be able to use the common interface with compilation database and options like -p, -extra-arg, etc. The testing support provided by clang-refactor is described below: When -selection=test:<file> is given, clang-refactor will parse the selection commands from that file. The selection commands are grouped and the specified refactoring action invoked by the tool. Each command in a group is expected to produce an identical result. The precise syntax for the selection commands is described in a comment in TestSupport.h. Differential Revision: https://reviews.llvm.org/D36574 llvm-svn: 313244
Diffstat (limited to 'clang/lib/Tooling/Refactoring/AtomicChange.cpp')
-rw-r--r--clang/lib/Tooling/Refactoring/AtomicChange.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Tooling/Refactoring/AtomicChange.cpp b/clang/lib/Tooling/Refactoring/AtomicChange.cpp
index 082bf5996df..e4cc6a5617b 100644
--- a/clang/lib/Tooling/Refactoring/AtomicChange.cpp
+++ b/clang/lib/Tooling/Refactoring/AtomicChange.cpp
@@ -215,6 +215,15 @@ AtomicChange::AtomicChange(std::string Key, std::string FilePath,
RemovedHeaders(std::move(RemovedHeaders)), Replaces(std::move(Replaces)) {
}
+bool AtomicChange::operator==(const AtomicChange &Other) const {
+ if (Key != Other.Key || FilePath != Other.FilePath || Error != Other.Error)
+ return false;
+ if (!(Replaces == Other.Replaces))
+ return false;
+ // FXIME: Compare header insertions/removals.
+ return true;
+}
+
std::string AtomicChange::toYAMLString() {
std::string YamlContent;
llvm::raw_string_ostream YamlContentStream(YamlContent);
OpenPOWER on IntegriCloud