[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

llvm-svn: 375003
This commit is contained in:
Yitzhak Mandelbaum 2019-10-16 14:26:20 +00:00
parent 28a3b2aeb4
commit c14f1ea25e
4 changed files with 16 additions and 9 deletions

View File

@ -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;

View File

@ -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 S, TextGenerator Replacement) {
/// 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::MatchFinder::MatchResult &Result,
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 {

View File

@ -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;

View File

@ -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 {