r375003 - [libTooling] Fix r374962: add more Transformer forwarding decls.
Yitzhak Mandelbaum via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 16 07:26:20 PDT 2019
Author: ymandel
Date: Wed Oct 16 07:26:20 2019
New Revision: 375003
URL: http://llvm.org/viewvc/llvm-project?rev=375003&view=rev
Log:
[libTooling] Fix r374962: add more Transformer forwarding decls.
Summary:
The move to a new, single namespace in r374962 left out some type definitions
from the old namespace and resulted in one naming conflict (`text`). This
revision adds aliases for those definitions and removes one of the `text`
functions from the new namespace.
Reviewers: alexfh
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69036
Modified:
cfe/trunk/include/clang/Tooling/Transformer/RangeSelector.h
cfe/trunk/include/clang/Tooling/Transformer/RewriteRule.h
cfe/trunk/include/clang/Tooling/Transformer/Stencil.h
cfe/trunk/unittests/Tooling/TransformerTest.cpp
Modified: cfe/trunk/include/clang/Tooling/Transformer/RangeSelector.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Transformer/RangeSelector.h?rev=375003&r1=375002&r2=375003&view=diff
==============================================================================
--- cfe/trunk/include/clang/Tooling/Transformer/RangeSelector.h (original)
+++ cfe/trunk/include/clang/Tooling/Transformer/RangeSelector.h Wed Oct 16 07:26:20 2019
@@ -92,6 +92,8 @@ RangeSelector expansion(RangeSelector S)
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;
Modified: cfe/trunk/include/clang/Tooling/Transformer/RewriteRule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Transformer/RewriteRule.h?rev=375003&r1=375002&r2=375003&view=diff
==============================================================================
--- cfe/trunk/include/clang/Tooling/Transformer/RewriteRule.h (original)
+++ cfe/trunk/include/clang/Tooling/Transformer/RewriteRule.h Wed Oct 16 07:26:20 2019
@@ -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 @@ inline ASTEdit insertAfter(RangeSelector
/// 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 @@ translateEdits(const ast_matchers::Match
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::insertAfter;
using transformer::insertBefore;
using transformer::makeRule;
using transformer::remove;
-using transformer::text;
using transformer::RewriteRule;
using transformer::IncludeFormat;
namespace detail {
Modified: cfe/trunk/include/clang/Tooling/Transformer/Stencil.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Transformer/Stencil.h?rev=375003&r1=375002&r2=375003&view=diff
==============================================================================
--- cfe/trunk/include/clang/Tooling/Transformer/Stencil.h (original)
+++ cfe/trunk/include/clang/Tooling/Transformer/Stencil.h Wed Oct 16 07:26:20 2019
@@ -195,9 +195,11 @@ StencilPart dPrint(llvm::StringRef Id);
} // 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;
Modified: cfe/trunk/unittests/Tooling/TransformerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/TransformerTest.cpp?rev=375003&r1=375002&r2=375003&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/TransformerTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/TransformerTest.cpp Wed Oct 16 07:26:20 2019
@@ -21,7 +21,6 @@ using namespace ast_matchers;
namespace {
using ::testing::IsEmpty;
using transformer::RewriteRule;
-using transformer::text;
constexpr char KHeaderContents[] = R"cc(
struct string {
More information about the cfe-commits
mailing list