[PATCH] D157777: [ASTMatcher] Add matcher for 'MacroQualifiedType'

Ding Fei via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 19:45:40 PDT 2023


danix800 added inline comments.


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:7261
 
+/// Matches macro qualified types.
+///
----------------
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`.


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