From 0dccd1a0fd41eb29c0e072b5a5a527f5be388642 Mon Sep 17 00:00:00 2001 From: Renato Golin Date: Fri, 7 Oct 2016 13:58:10 +0000 Subject: 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 --- clang-tools-extra/clang-move/ClangMove.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'clang-tools-extra/clang-move/ClangMove.cpp') 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 ClassNames; - llvm::StringRef(Spec.Names).split(ClassNames, ','); - Optional> 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); -- cgit v1.2.3