[PATCH] D62390: [LibTooling] Add Explanation parameter to `makeRule`.
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 24 08:10:42 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361643: [LibTooling] Add Explanation parameter to `makeRule`. (authored by ymandel, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D62390?vs=201229&id=201251#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62390/new/
https://reviews.llvm.org/D62390
Files:
cfe/trunk/include/clang/Tooling/Refactoring/Transformer.h
cfe/trunk/lib/Tooling/Refactoring/Transformer.cpp
cfe/trunk/unittests/Tooling/TransformerTest.cpp
Index: cfe/trunk/include/clang/Tooling/Refactoring/Transformer.h
===================================================================
--- cfe/trunk/include/clang/Tooling/Refactoring/Transformer.h
+++ cfe/trunk/include/clang/Tooling/Refactoring/Transformer.h
@@ -125,14 +125,16 @@
/// Convenience function for constructing a simple \c RewriteRule.
RewriteRule makeRule(ast_matchers::internal::DynTypedMatcher M,
- SmallVector<ASTEdit, 1> Edits);
+ SmallVector<ASTEdit, 1> Edits,
+ TextGenerator Explanation = nullptr);
/// Convenience overload of \c makeRule for common case of only one edit.
inline RewriteRule makeRule(ast_matchers::internal::DynTypedMatcher M,
- ASTEdit Edit) {
+ ASTEdit Edit,
+ TextGenerator Explanation = nullptr) {
SmallVector<ASTEdit, 1> Edits;
Edits.emplace_back(std::move(Edit));
- return makeRule(std::move(M), std::move(Edits));
+ return makeRule(std::move(M), std::move(Edits), std::move(Explanation));
}
/// Applies the first rule whose pattern matches; other rules are ignored.
Index: cfe/trunk/lib/Tooling/Refactoring/Transformer.cpp
===================================================================
--- cfe/trunk/lib/Tooling/Refactoring/Transformer.cpp
+++ cfe/trunk/lib/Tooling/Refactoring/Transformer.cpp
@@ -96,10 +96,10 @@
return E;
}
-RewriteRule tooling::makeRule(DynTypedMatcher M,
- SmallVector<ASTEdit, 1> Edits) {
- return RewriteRule{
- {RewriteRule::Case{std::move(M), std::move(Edits), nullptr}}};
+RewriteRule tooling::makeRule(DynTypedMatcher M, SmallVector<ASTEdit, 1> Edits,
+ TextGenerator Explanation) {
+ return RewriteRule{{RewriteRule::Case{std::move(M), std::move(Edits),
+ std::move(Explanation)}}};
}
// Determines whether A is a base type of B in the class hierarchy, including
Index: cfe/trunk/unittests/Tooling/TransformerTest.cpp
===================================================================
--- cfe/trunk/unittests/Tooling/TransformerTest.cpp
+++ cfe/trunk/unittests/Tooling/TransformerTest.cpp
@@ -147,8 +147,7 @@
on(expr(hasType(isOrPointsTo(StringType)))
.bind(StringExpr)),
callee(cxxMethodDecl(hasName("c_str")))))),
- change(text("REPLACED")));
- R.Cases[0].Explanation = text("Use size() method directly on string.");
+ change(text("REPLACED")), text("Use size() method directly on string."));
return R;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62390.201251.patch
Type: text/x-patch
Size: 2687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190524/bc8b9f1e/attachment.bin>
More information about the cfe-commits
mailing list