<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>But yeah - we do have the <a href="https://reviews.llvm.org/D4234" target="_blank">https://reviews.llvm.org/D4234</a> "LocTrackingOnly" mode which looks like it could be used for Rpass diagnostics, for instance. (& removing use of the AST from the LLVM diagnostic system might help make it more consistent behavior even when doing LTO or other separations between AST parsing and IR transformations)<br></div></div></div></blockquote><div><br></div><div>Thanks for the pointer to that. I was getting confused because "-Rpass=foo" was triggering LocTrackingOnly but "-Rpass" wasn't, which I've fixed. So -Rpass is no longer a concern.</div><div><br></div><div>So we just have to worry about non-Rpass diagnostics, e.g. -fwarn-stack-size. All of these only use the function name for source locations. We can either just give up and have worse diagnostics for these, meaning no demangling and no source location per diagnostic, or create a side table of these right before codegen as you suggested. For now I'll go with creating a side table to preserve the status quo, hopefully its construction runtime is not measurable.</div><div><br></div><div>Inline asm is special in that it carries around a source location token even in the IR, so we don't need to go through the AST to find a source location which is nice.</div></div></div>