|
@@ -31,11 +31,6 @@
|
|
namespace clang {
|
|
namespace clang {
|
|
namespace transformer {
|
|
namespace transformer {
|
|
using TextGenerator = MatchConsumer<std::string>;
|
|
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.
|
|
// 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
|
|
// 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.
|
|
/// Removes the source selected by \p S.
|
|
inline ASTEdit remove(RangeSelector 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
|
|
/// 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 {
|
|
namespace tooling {
|
|
// DEPRECATED: These are temporary aliases supporting client migration to the
|
|
// DEPRECATED: These are temporary aliases supporting client migration to the
|
|
// `transformer` namespace.
|
|
// `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::addInclude;
|
|
using transformer::applyFirst;
|
|
using transformer::applyFirst;
|
|
using transformer::change;
|
|
using transformer::change;
|
|
@@ -293,7 +298,6 @@ using transformer::insertAfter;
|
|
using transformer::insertBefore;
|
|
using transformer::insertBefore;
|
|
using transformer::makeRule;
|
|
using transformer::makeRule;
|
|
using transformer::remove;
|
|
using transformer::remove;
|
|
-using transformer::text;
|
|
|
|
using transformer::RewriteRule;
|
|
using transformer::RewriteRule;
|
|
using transformer::IncludeFormat;
|
|
using transformer::IncludeFormat;
|
|
namespace detail {
|
|
namespace detail {
|