[PATCH] D117613: [ASTMatchers] Add `isConsteval` matcher
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 20 03:29:17 PST 2022
cor3ntin added inline comments.
================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:5179
+/// consteval int bar();
+/// void baz() { if consteval {} }
+/// \endcode
----------------
Izaron wrote:
> aaron.ballman wrote:
> > It'd be good to show an example of:
> > ```
> > if ! consteval {}
> >
> > if ! consteval {} else {}
> > ```
> > as well so users know what to expect.
> >
> > Should there be a matcher so users can distinguish between `if consteval` and `if ! consteval`?
> >
> > Test cases for these sort of things would also be appreciated.
> Thanks!
> > Should there be a matcher so users can distinguish between `if consteval` and `if ! consteval`?
> This is an interesting question. I wonder how intensively `if ! consteval` is ever going to be used in real life to make a unique matcher for it? I can't make up a hypothetical checker that would need it.
>
> Let's see what other fellow reviewers think about it =)
That's a good question.
Maybe we can add it later if there is a need?
I suspect that if we need 2, we need 3, `hasConsteval`, `hasNegatedConsteval`, `hasNonNegatedConsteval`
Until a need present itself, maybe one is enough
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117613/new/
https://reviews.llvm.org/D117613
More information about the cfe-commits
mailing list