[PATCH] D130123: Extend ptr32 support to be applied on typedef
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 20 10:56:55 PDT 2022
rnk added inline comments.
================
Comment at: clang/lib/Sema/SemaType.cpp:7116
+ for (;;) {
+ if (const TypedefType *TT = dyn_cast<TypedefType>(Desugared)) {
+ Desugared = TT->desugar();
----------------
Ariel-Burton wrote:
> rnk wrote:
> > This seems like a good place to use getSingleStepDesugaredType to look through all type sugar (parens, typedefs, template substitutions, etc).
> > This seems like a good place to use getSingleStepDesugaredType to look through all type sugar (parens, typedefs, template substitutions, etc).
>
> I'm not sure what you mean. Could you expand a little, please?
Clang's AST has lots of "type sugar nodes". These are types which usually don't have any semantic meaning, they just carry source location information, like whether there was a typedef or extra parens in the type. AttributedType is also a type sugar node, so we cannot do a full desugaring here, we have to step through each node one at a time to accumulate the attributes.
Your code looks through one kind of type sugar, but this loop should probably be generalized to handle all kinds of type sugar. I think getSingleStepDesugaredType will do that.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130123/new/
https://reviews.llvm.org/D130123
More information about the cfe-commits
mailing list