[PATCH] D69036: [libTooling] Fix r374962: add more Transformer forwarding decls.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 16 07:30:56 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc14f1ea25e05: [libTooling] Fix r374962: add more Transformer forwarding decls. (authored by ymandel).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69036/new/

https://reviews.llvm.org/D69036

Files:
  clang/include/clang/Tooling/Transformer/RangeSelector.h
  clang/include/clang/Tooling/Transformer/RewriteRule.h
  clang/include/clang/Tooling/Transformer/Stencil.h
  clang/unittests/Tooling/TransformerTest.cpp


Index: clang/unittests/Tooling/TransformerTest.cpp
===================================================================
--- clang/unittests/Tooling/TransformerTest.cpp
+++ clang/unittests/Tooling/TransformerTest.cpp
@@ -21,7 +21,6 @@
 namespace {
 using ::testing::IsEmpty;
 using transformer::RewriteRule;
-using transformer::text;
 
 constexpr char KHeaderContents[] = R"cc(
   struct string {
Index: clang/include/clang/Tooling/Transformer/Stencil.h
===================================================================
--- clang/include/clang/Tooling/Transformer/Stencil.h
+++ clang/include/clang/Tooling/Transformer/Stencil.h
@@ -195,9 +195,11 @@
 } // namespace transformer
 
 namespace tooling {
-namespace stencil {
 // DEPRECATED: These are temporary aliases supporting client migration to the
 // `transformer` namespace.
+using Stencil = transformer::Stencil;
+using StencilPart = transformer::StencilPart;
+namespace stencil {
 using transformer::access;
 using transformer::addressOf;
 using transformer::cat;
Index: clang/include/clang/Tooling/Transformer/RewriteRule.h
===================================================================
--- clang/include/clang/Tooling/Transformer/RewriteRule.h
+++ clang/include/clang/Tooling/Transformer/RewriteRule.h
@@ -31,11 +31,6 @@
 namespace clang {
 namespace transformer {
 using TextGenerator = MatchConsumer<std::string>;
-/// Wraps a string as a TextGenerator.
-inline TextGenerator text(std::string M) {
-  return [M](const ast_matchers::MatchFinder::MatchResult &)
-             -> Expected<std::string> { return M; };
-}
 
 // Description of a source-code edit, expressed in terms of an AST node.
 // Includes: an ID for the (bound) node, a selector for source related to the
@@ -221,7 +216,9 @@
 
 /// Removes the source selected by \p S.
 inline ASTEdit remove(RangeSelector S) {
-  return change(std::move(S), text(""));
+  return change(std::move(S),
+                [](const ast_matchers::MatchFinder::MatchResult &)
+                    -> Expected<std::string> { return ""; });
 }
 
 /// The following three functions are a low-level part of the RewriteRule
@@ -286,6 +283,14 @@
 namespace tooling {
 // DEPRECATED: These are temporary aliases supporting client migration to the
 // `transformer` namespace.
+/// Wraps a string as a TextGenerator.
+using TextGenerator = transformer::TextGenerator;
+
+inline TextGenerator text(std::string M) {
+  return [M](const ast_matchers::MatchFinder::MatchResult &)
+             -> Expected<std::string> { return M; };
+}
+
 using transformer::addInclude;
 using transformer::applyFirst;
 using transformer::change;
@@ -293,7 +298,6 @@
 using transformer::insertBefore;
 using transformer::makeRule;
 using transformer::remove;
-using transformer::text;
 using transformer::RewriteRule;
 using transformer::IncludeFormat;
 namespace detail {
Index: clang/include/clang/Tooling/Transformer/RangeSelector.h
===================================================================
--- clang/include/clang/Tooling/Transformer/RangeSelector.h
+++ clang/include/clang/Tooling/Transformer/RangeSelector.h
@@ -92,6 +92,8 @@
 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69036.225219.patch
Type: text/x-patch
Size: 3389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191016/d7c7a254/attachment.bin>


More information about the cfe-commits mailing list