simon_tatham added a comment. I looked into this yesterday, and realised that I don't actually know what the use case //is// for emitting `!srcloc` metadata in an IR file.
It's more or less ignored by llc, as far as I can see: if there's a late-breaking error in the inline asm string, you just get a "note: !srcloc = <nnn>" alongside the main error. And if the IR file is read back in by a second invocation of clang, then the frontend callback //does// get the !srcloc back from the IR, but it can't relate that to the original source code, because the new clang's SourceManager doesn't know anything about the C source files that the IR was made from. In the example test I just did by hand, the error message cites a location in the IR file that corresponds to the byte position of the error in the original C, which is more or less useless. So I think this mechanism is only actually useful when the whole compilation is happening within a single invocation of clang, so that the !srcloc finds its way back to a SourceManager that still has all the actual source code in mind. As soon as IR files are exported and re-imported, the best we can hope for is "no crash". But I can add a couple of tests along those lines for i32 and i64 versions of !srcloc, if that's helpful. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105491/new/ https://reviews.llvm.org/D105491 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits