[PATCH] D56090: Add a matcher for members of an initializer list expression

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 3 09:42:38 PST 2019


aaron.ballman added a subscriber: klimek.
aaron.ballman added inline comments.


================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:3527
+  return N < Node.getNumInits() &&
+          InnerMatcher.matches(*Node.getInit(N)->IgnoreParenImpCasts(), Finder,
+                               Builder);
----------------
hwright wrote:
> aaron.ballman wrote:
> > I'm not certain we want the `IgnoreParenImpCasts()` here -- what if someone wants to match an initializer that uses one of those properties?
> The `hasArg` implementation directly above has the same call to `IgnoreParenImpCasts()`.  Is it also in error?  (It would seem that they should both be consistent.)
Yeah, I noticed that as well. Doing some code archaeology, it seems that `hasArg()` has had that form since its inception and it was never explicitly discussed what should happen there.

@klimek -- do you have opinions here, since you wrote the original code for `hasArg()`? Should we be leaving the paren and implicit cast stripping up to the caller rather than doing it automatically?


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

https://reviews.llvm.org/D56090





More information about the cfe-commits mailing list