This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGfdff677a9557: [libTooling] Remove deprecated Clang Transformer declarations (authored by ymandel).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92340/new/ https://reviews.llvm.org/D92340 Files: clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp clang/include/clang/Tooling/Transformer/RangeSelector.h clang/include/clang/Tooling/Transformer/RewriteRule.h clang/lib/Tooling/Transformer/RewriteRule.cpp clang/unittests/Tooling/TransformerTest.cpp
Index: clang/unittests/Tooling/TransformerTest.cpp =================================================================== --- clang/unittests/Tooling/TransformerTest.cpp +++ clang/unittests/Tooling/TransformerTest.cpp @@ -21,12 +21,21 @@ using namespace tooling; using namespace ast_matchers; namespace { +using ::clang::transformer::addInclude; +using ::clang::transformer::applyFirst; +using ::clang::transformer::before; +using ::clang::transformer::cat; +using ::clang::transformer::changeTo; +using ::clang::transformer::makeRule; +using ::clang::transformer::member; +using ::clang::transformer::name; +using ::clang::transformer::node; +using ::clang::transformer::remove; +using ::clang::transformer::rewriteDescendants; +using ::clang::transformer::RewriteRule; +using ::clang::transformer::statement; using ::testing::ElementsAre; using ::testing::IsEmpty; -using transformer::cat; -using transformer::changeTo; -using transformer::rewriteDescendants; -using transformer::RewriteRule; constexpr char KHeaderContents[] = R"cc( struct string { @@ -339,8 +348,9 @@ TEST_F(TransformerTest, NodePartMember) { StringRef E = "expr"; - RewriteRule Rule = makeRule(memberExpr(member(hasName("bad"))).bind(E), - changeTo(member(std::string(E)), cat("good"))); + RewriteRule Rule = + makeRule(memberExpr(clang::ast_matchers::member(hasName("bad"))).bind(E), + changeTo(member(std::string(E)), cat("good"))); std::string Input = R"cc( struct S { Index: clang/lib/Tooling/Transformer/RewriteRule.cpp =================================================================== --- clang/lib/Tooling/Transformer/RewriteRule.cpp +++ clang/lib/Tooling/Transformer/RewriteRule.cpp @@ -439,7 +439,3 @@ } const llvm::StringRef RewriteRule::RootID = ::clang::transformer::RootID; - -TextGenerator tooling::text(std::string M) { - return std::make_shared<SimpleTextGenerator>(std::move(M)); -} Index: clang/include/clang/Tooling/Transformer/RewriteRule.h =================================================================== --- clang/include/clang/Tooling/Transformer/RewriteRule.h +++ clang/include/clang/Tooling/Transformer/RewriteRule.h @@ -446,28 +446,6 @@ const RewriteRule &Rule); } // namespace detail } // namespace transformer - -namespace tooling { -// DEPRECATED: These are temporary aliases supporting client migration to the -// `transformer` namespace. -/// Wraps a string as a TextGenerator. -using TextGenerator = transformer::TextGenerator; - -TextGenerator text(std::string M); - -using transformer::addInclude; -using transformer::applyFirst; -using transformer::change; -using transformer::insertAfter; -using transformer::insertBefore; -using transformer::makeRule; -using transformer::remove; -using transformer::RewriteRule; -using transformer::IncludeFormat; -namespace detail { -using namespace transformer::detail; -} // namespace detail -} // namespace tooling } // namespace clang #endif // LLVM_CLANG_TOOLING_TRANSFORMER_REWRITE_RULE_H_ Index: clang/include/clang/Tooling/Transformer/RangeSelector.h =================================================================== --- clang/include/clang/Tooling/Transformer/RangeSelector.h +++ clang/include/clang/Tooling/Transformer/RangeSelector.h @@ -103,26 +103,6 @@ /// `SourceManager::getExpansionRange`. RangeSelector expansion(RangeSelector S); } // namespace transformer - -namespace tooling { -// DEPRECATED: These are temporary aliases supporting client migration to the -// `transformer` namespace. -using RangeSelector = transformer::RangeSelector; - -using transformer::after; -using transformer::before; -using transformer::callArgs; -using transformer::charRange; -using transformer::elseBranch; -using transformer::expansion; -using transformer::initListElements; -using transformer::member; -using transformer::name; -using transformer::node; -using transformer::range; -using transformer::statement; -using transformer::statements; -} // namespace tooling } // namespace clang #endif // LLVM_CLANG_TOOLING_REFACTOR_RANGE_SELECTOR_H_ Index: clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp =================================================================== --- clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp +++ clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp @@ -23,6 +23,7 @@ using transformer::cat; using transformer::change; using transformer::IncludeFormat; +using transformer::makeRule; using transformer::node; using transformer::RewriteRule; using transformer::statement; @@ -30,14 +31,14 @@ // Invert the code of an if-statement, while maintaining its semantics. RewriteRule invertIf() { StringRef C = "C", T = "T", E = "E"; - RewriteRule Rule = tooling::makeRule( - ifStmt(hasCondition(expr().bind(C)), hasThen(stmt().bind(T)), - hasElse(stmt().bind(E))), - change(statement(std::string(RewriteRule::RootID)), - cat("if(!(", node(std::string(C)), ")) ", - statement(std::string(E)), " else ", - statement(std::string(T)))), - cat("negate condition and reverse `then` and `else` branches")); + RewriteRule Rule = + makeRule(ifStmt(hasCondition(expr().bind(C)), hasThen(stmt().bind(T)), + hasElse(stmt().bind(E))), + change(statement(std::string(RewriteRule::RootID)), + cat("if(!(", node(std::string(C)), ")) ", + statement(std::string(E)), " else ", + statement(std::string(T)))), + cat("negate condition and reverse `then` and `else` branches")); return Rule; } @@ -70,10 +71,9 @@ class IntLitCheck : public TransformerClangTidyCheck { public: IntLitCheck(StringRef Name, ClangTidyContext *Context) - : TransformerClangTidyCheck(tooling::makeRule(integerLiteral(), - change(cat("LIT")), - cat("no message")), - Name, Context) {} + : TransformerClangTidyCheck( + makeRule(integerLiteral(), change(cat("LIT")), cat("no message")), + Name, Context) {} }; // Tests that two changes in a single macro expansion do not lead to conflicts @@ -95,7 +95,7 @@ public: BinOpCheck(StringRef Name, ClangTidyContext *Context) : TransformerClangTidyCheck( - tooling::makeRule( + makeRule( binaryOperator(hasOperatorName("+"), hasRHS(expr().bind("r"))), change(node("r"), cat("RIGHT")), cat("no message")), Name, Context) {} @@ -122,8 +122,8 @@ const ClangTidyCheck::OptionsView &Options) { if (!LangOpts.ObjC) return None; - return tooling::makeRule(clang::ast_matchers::functionDecl(), - change(cat("void changed() {}")), cat("no message")); + return makeRule(clang::ast_matchers::functionDecl(), + change(cat("void changed() {}")), cat("no message")); } class NeedsObjCCheck : public TransformerClangTidyCheck { @@ -147,8 +147,8 @@ const ClangTidyCheck::OptionsView &Options) { if (Options.get("Skip", "false") == "true") return None; - return tooling::makeRule(clang::ast_matchers::functionDecl(), - changeTo(cat("void nothing();")), cat("no message")); + return makeRule(clang::ast_matchers::functionDecl(), + changeTo(cat("void nothing();")), cat("no message")); } class ConfigurableCheck : public TransformerClangTidyCheck { @@ -174,9 +174,8 @@ RewriteRule replaceCall(IncludeFormat Format) { using namespace ::clang::ast_matchers; - RewriteRule Rule = - tooling::makeRule(callExpr(callee(functionDecl(hasName("f")))), - change(cat("other()")), cat("no message")); + RewriteRule Rule = makeRule(callExpr(callee(functionDecl(hasName("f")))), + change(cat("other()")), cat("no message")); addInclude(Rule, "clang/OtherLib.h", Format); return Rule; } Index: clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp +++ clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp @@ -29,6 +29,7 @@ using ::clang::transformer::change; using ::clang::transformer::makeRule; using ::clang::transformer::node; +using ::clang::transformer::RewriteRule; static const char DefaultStringLikeClasses[] = "::std::basic_string;" "::std::basic_string_view;" @@ -69,7 +70,7 @@ hasArgument(1, cxxDefaultArgExpr())), onImplicitObjectArgument(expr().bind("string_being_searched"))); - tooling::RewriteRule rule = applyFirst( + RewriteRule rule = applyFirst( {makeRule(binaryOperator(hasOperatorName("=="), hasOperands(ignoringParenImpCasts(StringNpos), ignoringParenImpCasts(StringFind))),
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits