Adds AST matcher for a FunctionDecl that has a trailing return type.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
| include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 5904 | I think this may cause failed assertions on code like void f(); when compiled in C mode because that FunctionDecl should have a type of FunctionNoProtoType. You should use getAs<FunctionProtoType>() and test for null. | |
| unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp | ||
| 2121 | Spurious semicolon in the test. | |
LGTM with a minor commenting/documentation nit.
| include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 5900 | Sorry for not noticing this earlier -- spurious semicolon here (don't forget to regenerate the docs too). | |
| include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 5906 | There are no negative tests in the unittest that cover this false path. | |
| include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 5906 | Is there a test case you would recommend? I'm not entirely sure what would be appropriate -- the tests compile in C++, yes? So void f(); would just be a normal function declaration (with a prototype, please correct me if I'm wrong). | |
| include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 5906 | I'd start by checking what @aaron.ballman has suggested: EXPECT_TRUE(notMatches("void f();")); | |
| include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 5906 | You'll need to use notMatchesC() to test that case (so you get a C input file instead of a C++ input file). | |
| include/clang/ASTMatchers/ASTMatchers.h | ||
|---|---|---|
| 5906 | Oh, sorry, indeed. | |
Sorry for not noticing this earlier -- spurious semicolon here (don't forget to regenerate the docs too).