Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/ASTMatchers/ASTMatchers.h | ||
---|---|---|
1998 | Missing changes to Registry.cpp to expose this to clang-query? | |
5340 | This change surprises me -- aren't rewritten binary operators *always* comparison operations? I don't know of a time when they'd ever be an assignment operator. | |
clang/lib/ASTMatchers/ASTMatchFinder.cpp | ||
260 | Please spell out this use of auto. |
clang/include/clang/ASTMatchers/ASTMatchers.h | ||
---|---|---|
5340 | Yes, which is why the new method in this patch on that class returns true. This makes it possible to write binaryOperation(isComparisonOperator()) binaryOperation(isAssignmentOperator()) (possibly with unless). | |
clang/lib/ASTMatchers/ASTMatchFinder.cpp | ||
260 | Please specify what to replace auto with when the replacement is a condition of acceptance. Type noise makes code less readable, especially if the type contains <, > ,, spaces or :: or a combination of all of them. There is also ambiguity about what part of the type is a namespace, and what is an enclosing class etc. Very confusing, In C++98 typedefs were often used to make that problem less bad. The C++11 solution is auto. So, you require that an auto must be replaced with something less optimal, please be specific about what you require it replaced with. I don't know what you want here, but my guess is it is a long type which makes the code less readable. |
LGTM aside from the auto usage.
clang/include/clang/ASTMatchers/ASTMatchers.h | ||
---|---|---|
5340 | Ohhh, I see what the intent is now. Thank you for clarifying! | |
clang/lib/ASTMatchers/ASTMatchFinder.cpp | ||
260 |
If I knew that information, I would likely have not had to make the suggestion in the first place (or I would have suggested it as an edit). FWIW, I think it's a bit unreasonable to expect your code reviewers to hunt down the information you have at your fingertips as the code author (you presumably know what types your code edits are using). From https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable: "Don’t “almost always” use auto, but do use auto with initializers like cast<Foo>(...) or other places where the type is already obvious from the context." There's nothing about this context that makes the type obvious to me. That said, I did the work and found the type should be spelled CXXRewriteBinaryOperator::DecomposedForm. |
Missing changes to Registry.cpp to expose this to clang-query?