Added AST matcher for ignoring elidable move constructors
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 33319 Build 33318: arc lint + arc unit
Event Timeline
| clang/include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 6455 | 80 columns | |
| 6455 | It would help if you described why a user would want to skip the elidable constructor using this matcher rather than hardcoding the presence of such an AST node. | |
| 6457 | I'd suggest to rephrase the example using the "Given:" format (see other comments around), and wrap the code to 80 columns. | |
| clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp | ||
| 575 | Can you run these tests in both C++14 and C++17 modes? | |
| 628 | Need a space before the open brace, and indentation in the function body (in every test). | |
| 631 | Please clang-format. | |
| clang/include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 6455 | "Matches expressions that match InnerMatcher that are possibly wrapped in an elidable constructor." Then a blank line, and the rest of the explanation. | |
| 6458 | part of the AST in C++14 and earlier. | |
| 6460 | Therefore, to write a matcher that works in all language modes, the matcher has to skip elidable constructor AST nodes if they appear in the AST. | |
| 6467 | Can this sample be simplified? For example, B does not need to be a template (I think), and f() can be simplified to not call B twice. | |
| clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp | ||
| 628 | Not done? I was talking about the code in the code snippet. | |
| clang/include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 6477 | Is the matcher only strict to move constructor? looks like the matcher implementation is for general constructors, just ignoringElidableConstructorCall? we may have elidable copy constructor. | |
| 6479 | nit: LLVM uses CamelCase style. | |
| 6486 | I think this return is unnecessary, since we will fall through at line 6489. | |
- Using CamelCase and also renamed ignoringElidableMoveConstructorCall to ignoringElidableConstructorCall
- Added match conditionally overload to control in what language standard a match should run in
| clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp | ||
|---|---|---|
| 600 | Please inline the variables that are used once. | |
| clang/unittests/ASTMatchers/ASTMatchersTest.h | ||
| 61 | Please drop the explicit values. | |
| 64 | 2a | |
| 68 | "2a" (we don't know the year yet) | |
| 144 | 80 columns. | |
| 154 | No need for semicolon. | |
| 157 | I'd say it is too clever, and suggest to write an explicit switch. | |
thanks, looks good to me. I'll commit for you. @gribozavr do you want to take another look on the patch?
| clang/unittests/ASTMatchers/ASTMatchersTest.h | ||
|---|---|---|
| 152 | this is not done? | |
| clang/unittests/ASTMatchers/ASTMatchersTest.h | ||
|---|---|---|
| 152 | But the switch covers all enum values so that would give warnings | |
80 columns