aaron.ballman added inline comments.
================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:5902
+AST_MATCHER(FunctionDecl, hasTrailingReturn) {
+ return Node.getType()->castAs<FunctionProtoType>()->hasTrailingReturn();
+}
----------------
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.
================
Comment at: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp:2121
+ functionDecl(hasTrailingReturn())));
+ EXPECT_TRUE(notMatches("int X() {};", functionDecl(hasTrailingReturn())));
+}
----------------
Spurious semicolon in the test.
https://reviews.llvm.org/D42273
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits