[PATCH] D71680: Customize simplified dumping and matching of LambdaExpr
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 20 11:33:35 PST 2019
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM aside from some nits.
================
Comment at: clang/include/clang/AST/ASTNodeTraverser.h:134
+
+ if (isa<LambdaExpr>(S) && Traversal == ast_type_traits::TK_IgnoreUnlessSpelledInSource)
return;
----------------
This seems like it may be over the 80 col limit?
================
Comment at: clang/include/clang/AST/ASTNodeTraverser.h:662
+ dumpTemplateParameters(Node->getTemplateParameterList());
+ auto CallOp = Node->getCallOperator();
+ for (auto *P : CallOp->parameters())
----------------
`const CXXMethodDecl *`, or just sink it into the range-based for loop since we don't really need the local anyway.
================
Comment at: clang/include/clang/AST/ASTNodeTraverser.h:663
+ auto CallOp = Node->getCallOperator();
+ for (auto *P : CallOp->parameters())
+ Visit(P);
----------------
`const auto *`
================
Comment at: clang/lib/ASTMatchers/ASTMatchFinder.cpp:219
+ return false;
+ } else if (!match(*Node->capture_init_begin()[I])) {
+ return false;
----------------
You can elide the braces, also you can remove the `else` after a `return`.
================
Comment at: clang/lib/ASTMatchers/ASTMatchFinder.cpp:223-224
+ }
+ auto *TPL = Node->getTemplateParameterList();
+ if (TPL) {
+ for (const auto *TP : *TPL) {
----------------
```
if (const TemplateParameterList *TPL = Node->getTemplateParameterList()) {
...
}
```
================
Comment at: clang/lib/ASTMatchers/ASTMatchFinder.cpp:226
+ for (const auto *TP : *TPL) {
+ if (!match(*TP)) {
+ return false;
----------------
Elide braces
================
Comment at: clang/lib/ASTMatchers/ASTMatchFinder.cpp:232
+
+ auto CallOp = Node->getCallOperator();
+ for (auto *P : CallOp->parameters()) {
----------------
`const CXXMethodDecl *`
================
Comment at: clang/lib/ASTMatchers/ASTMatchFinder.cpp:234
+ for (auto *P : CallOp->parameters()) {
+ if (!match(*P)) {
+ return false;
----------------
Elide braces
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71680/new/
https://reviews.llvm.org/D71680
More information about the cfe-commits
mailing list