[PATCH] D157777: [ASTMatcher] Add matcher for 'MacroQualifiedType'
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 15 05:10:36 PDT 2023
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM!
================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:7261
+/// Matches macro qualified types.
+///
----------------
danix800 wrote:
> aaron.ballman wrote:
> > How about: Matches qualified types when the qualifier is applied via a macro.
> >
> > and then a second example like:
> > ```
> > int * const qual_ptr;
> >
> > #define nonnull _Nonnull
> > int * const nonnull macro_qual_ptr;
> > ```
> > where we match `macro_qual_ptr` but not `qual_ptr`.
> > How about: Matches qualified types when the qualifier is applied via a macro.
>
> Forgive my broken English! :-)
>
> > and then a second example like:
> > ```
> > int * const qual_ptr;
> >
> > #define nonnull _Nonnull
> > int * const nonnull macro_qual_ptr;
> > ```
> > where we match `macro_qual_ptr` but not `qual_ptr`.
>
> Thanks for reminding me of the counter-example, it's critical for better test coverage.
>
> I'll pertain to the original one but with counter-example appended, because the macro
> `nonnull` in this case will not generate a `MacroQualifiedType` for `macro_qual_ptr`.
> Forgive my broken English! :-)
There's nothing to forgive! :-)
> I'll pertain to the original one but with counter-example appended, because the macro nonnull in this case will not generate a MacroQualifiedType for macro_qual_ptr.
Oh, interesting! (I didn't test my example, so that's neat to learn.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157777/new/
https://reviews.llvm.org/D157777
More information about the cfe-commits
mailing list