summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-move/ClangMove.cpp
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2016-10-07 13:58:10 +0000
committerRenato Golin <renato.golin@linaro.org>2016-10-07 13:58:10 +0000
commit0dccd1a0fd41eb29c0e072b5a5a527f5be388642 (patch)
tree96a7b6a30c424504db0d1a873ff1f05cf4b76763 /clang-tools-extra/clang-move/ClangMove.cpp
parentd47feecc453464609cf941460a76bf7e57f48956 (diff)
downloadbcm5719-llvm-0dccd1a0fd41eb29c0e072b5a5a527f5be388642.tar.gz
bcm5719-llvm-0dccd1a0fd41eb29c0e072b5a5a527f5be388642.zip
Revert "[clang-move] Support moving multiple classes in one run."
This reverts commit r283526 et al as it keeps randomly breaking bots, even after the commit has gone, on other people's commit ranges. Revert "[clang-move] Simplify lint tests" (r283545). Revert "Fix buildbot error." (r283534). Revert "Revert "fix buildbot error" since it is not right fix." (r283538). llvm-svn: 283553
Diffstat (limited to 'clang-tools-extra/clang-move/ClangMove.cpp')
-rw-r--r--clang-tools-extra/clang-move/ClangMove.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/clang-tools-extra/clang-move/ClangMove.cpp b/clang-tools-extra/clang-move/ClangMove.cpp
index 5cb50b601e1..c60b5e583ca 100644
--- a/clang-tools-extra/clang-move/ClangMove.cpp
+++ b/clang-tools-extra/clang-move/ClangMove.cpp
@@ -287,43 +287,31 @@ ClangMoveTool::ClangMoveTool(
: Spec(MoveSpec), FileToReplacements(FileToReplacements),
OriginalRunningDirectory(OriginalRunningDirectory),
FallbackStyle(FallbackStyle) {
+ Spec.Name = llvm::StringRef(Spec.Name).ltrim(':');
if (!Spec.NewHeader.empty())
CCIncludes.push_back("#include \"" + Spec.NewHeader + "\"\n");
}
void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
- SmallVector<StringRef, 4> ClassNames;
- llvm::StringRef(Spec.Names).split(ClassNames, ',');
- Optional<ast_matchers::internal::Matcher<NamedDecl>> InMovedClassNames;
- for (StringRef ClassName : ClassNames) {
- llvm::StringRef GlobalClassName = ClassName.trim().ltrim(':');
- const auto HasName = hasName(("::" + GlobalClassName).str());
- InMovedClassNames =
- InMovedClassNames ? anyOf(*InMovedClassNames, HasName) : HasName;
- }
- if (!InMovedClassNames) {
- llvm::errs() << "No classes being moved.\n";
- return;
- }
-
+ std::string FullyQualifiedName = "::" + Spec.Name;
auto InOldHeader = isExpansionInFile(
MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader));
auto InOldCC = isExpansionInFile(
MakeAbsolutePath(OriginalRunningDirectory, Spec.OldCC));
auto InOldFiles = anyOf(InOldHeader, InOldCC);
auto InMovedClass =
- hasDeclContext(cxxRecordDecl(*InMovedClassNames));
+ hasDeclContext(cxxRecordDecl(hasName(FullyQualifiedName)));
// Match moved class declarations.
auto MovedClass = cxxRecordDecl(
- InOldFiles, *InMovedClassNames, isDefinition(),
+ InOldFiles, hasName(FullyQualifiedName), isDefinition(),
hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl())));
Finder->addMatcher(MovedClass.bind("moved_class"), this);
// Match moved class methods (static methods included) which are defined
// outside moved class declaration.
Finder->addMatcher(cxxMethodDecl(InOldFiles,
- ofClass(*InMovedClassNames),
+ ofClass(hasName(FullyQualifiedName)),
isDefinition())
.bind("class_method"),
this);
OpenPOWER on IntegriCloud