[PATCH] D72505: [ASTMatchers] extract public matchers from const-analysis into own patch

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 08:39:27 PST 2020


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from a testing request.



================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:4243
+      if (FProto) {
+        QualType ParamType = FProto->getParamType(ParamIndex);
+        if (ParamMatcher.matches(ParamType, Finder, &ParamMatches)) {
----------------
JonasToth wrote:
> aaron.ballman wrote:
> > Should we be canonicalizing this type as well?
> I think here we shouldn't. In that case you could not match if e.g. the parameter has a typedef. I think that would reduce possibilities for the matcher usage.
Okay, that's a good point!


================
Comment at: clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp:868
+    std::make_unique<VerifyIdIsBoundTo<DeclRefExpr>>("arg")));
+}
+
----------------
I would like to see one K&R C test case just to be sure we're not doing anything horrible:
```
void f();
void call_it_1(void) { f(1.0f, 2.0f); } // Especially curious about type promotions

void f(a, b) float a, b; { }
void call_it_2(void) { f(1.0f, 2.0f); } // And if they differ here (IIRC, we may have a bug here in the compiler)
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72505/new/

https://reviews.llvm.org/D72505





More information about the cfe-commits mailing list