[clang] Emit debug info with original source location for tokens from macros … (PR #163190)

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 15 10:56:00 PDT 2025


https://github.com/dwblaikie commented:

Looks about right to me.

Are there any uses of "unrefined" locations in `CGDebugInfo` with this patch? If there are, what's the distinction/how was it chosen which would be refined, and which would not?
The slow/fast path through `getRefinedSpellingLoc` probably isn't worth it - probably make the whole thing outofline?

Some questions for other reviewers, etc:
1) `getRefinedSpellingLoc` - I'm not sure "refined" carries enough information (is it a reference to some other existing use of the term?) - but I don't have any great suggestions for a name. Perhaps "immediate" or "local" spelling location?
2) it's probably not practical to test all the modified code paths - any thoughts on what the right testing tradeoff is here? That various codepaths /inside/ `getRefinedSpellingLoc` are tested, from perhaps a variety of call sites/ways that manifests in the resulting IR metadata without being exhaustive, seems OK to me? (so perhaps in the test case at least an instruction location and a type location could be tested?)

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


More information about the cfe-commits mailing list