[PATCH] D130308: [clang] extend getCommonSugaredType to merge sugar nodes

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 1 20:10:14 PDT 2022


ChuanqiXu added inline comments.


================
Comment at: clang/include/clang/AST/ASTContext.h:1369
   }
+  QualType getDecayedType(QualType T, QualType Decayed) const;
 
----------------
mizvekov wrote:
> ChuanqiXu wrote:
> > mizvekov wrote:
> > > ChuanqiXu wrote:
> > > > Maybe we need a comment for this. The signature looks not straight forward and I can't relate this to the above comment.
> > > I think I wanted to make this an internal variant, since we will probably never need this outside of ASTContext anyway, but there is the friendship situation between Type and ASTContext. Maybe making this private would be for the best.
> > Yeah, the signature confused me as well... as long as the second parameter is `Decayed` already, why we need to get the decayed type again? I guess `Underlying` may be a better name.
> Ah I see, but this confusion already existed. See the definition of DecayedType in Type.h, where you have the `QualType getDecayedType()` member. This is what this Decayed parameter represents, what we will put in there to be returned by that method.
> 
> For DecayedType / AdjustedType / AttributedType there exists this confusion where they have two child nodes, which arbitrarily picking one of them to be called the `UnderlyingType` could be controversial. You could make the case that it should be the same one we use for implementing `desugar`, but there are arguments there for the other case.
I see. I got your point. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130308



More information about the cfe-commits mailing list