[clang] [Clang] Workaround dependent source location issues (PR #106925)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 3 10:30:43 PDT 2024
================
@@ -5443,11 +5443,24 @@ struct EnsureImmediateInvocationInDefaultArgs
// Rewrite to source location to refer to the context in which they are used.
ExprResult TransformSourceLocExpr(SourceLocExpr *E) {
- if (E->getParentContext() == SemaRef.CurContext)
+ DeclContext *DC = E->getParentContext();
+ if (DC == SemaRef.CurContext)
return E;
- return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(),
- E->getBeginLoc(), E->getEndLoc(),
- SemaRef.CurContext);
+
+ // FIXME: During instantiation, because the rebuild of defaults arguments
+ // is not always done in the context of the template instantiator,
+ // we run the risk of producing a dependent source location
+ // that would never be rebuilt.
+ // This usually happen during overloadĀ resolution, or in contexts
----------------
AaronBallman wrote:
```suggestion
// This usually happens during overloadĀ resolution, or in contexts
```
https://github.com/llvm/llvm-project/pull/106925
More information about the cfe-commits
mailing list