[PATCH] D42273: Add hasTrailingReturn AST matcher

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 20 06:53:35 PST 2018

lebedev.ri added inline comments.

Comment at: include/clang/ASTMatchers/ASTMatchers.h:5904
+    return F->hasTrailingReturn();
+  return false;
aaron.ballman wrote:
> lebedev.ri wrote:
> > juliehockett wrote:
> > > lebedev.ri wrote:
> > > > There are no negative tests in the unittest that cover this false path.
> > > 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). 
> > I'd start by checking what @aaron.ballman has suggested:
> > ```
> > EXPECT_TRUE(notMatches("void f();"));
> > ```
> > 
> You'll need to use `notMatchesC()` to test that case (so you get a C input file instead of a C++ input file).
Oh, sorry, indeed.
I did mean `notMatchesC()`, the trailing `C` was lost during copy-paste.


More information about the cfe-commits mailing list