[PATCH] D122586: Fix template instantiation of UDLs

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 28 11:26:35 PDT 2022


cor3ntin accepted this revision.
cor3ntin added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Sema/TreeTransform.h:10516
 TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *E) {
-  if (FunctionDecl *FD = E->getDirectCallee())
-    SemaRef.MarkFunctionReferenced(E->getBeginLoc(), FD);
-  return SemaRef.MaybeBindToTemporary(E);
+  return TransformCallExpr(E);
 }
----------------
erichkeane wrote:
> aaron.ballman wrote:
> > cor3ntin wrote:
> > > erichkeane wrote:
> > > > I THINK you have to do this by doing `getDerived().TransformCallExpr(E)`.  
> > > > 
> > > Oh yes, good point
> > Hmmm, don't we want this level of transformation to kick in, not the derived? e.g., another approach would be to remove the definition of this function entirely so that the recursive AST visitor calls `TransformCallExpr()` instead?
> No, the idea is that `TreeTransform` is inherited by other 'instantiator' types.  IF those types do something special for `CallExpr`, we want this to ALSO do the same thing as `CallExpr`.  
> 
> I was also thinking about removing the function altogether.  I just couldn't remember if `TreeTransform` did that right :) I'd suggest that if possible.
I tried to remove the overload entirely, clang was deeply unhappy :) 


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

https://reviews.llvm.org/D122586



More information about the cfe-commits mailing list