[clang] [clang] SourceLocIdentKind::Function should not be dependent (PR #94942)

Qizhi Hu via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 06:15:23 PDT 2024


jcsxky wrote:

> SourceLocation needs to be dependent because we want to make the name of the function and any template parameter refers to the instantiated function rather than that of the function template. This was changed in #78436
> 
> The issue is that SourceLocation then is a dependent expression that does not depend on any parameters and its never re-transformed (hence the crash).
> 
> I have so far been unable to find a solution. I wonder if we should attach the template parameters to the source location expression, but that seems a bit involved.

I tested this patch locally with the code from https://github.com/llvm/llvm-project/issues/78128 and it works well. I doubt whether we need to make `SourceLocation` dependent when `Kind` is `SourceLocIdentKind::Function`. I don't come up with a testcase that make this patch failed or crash.

https://github.com/llvm/llvm-project/pull/94942


More information about the cfe-commits mailing list