Including location information when calling `reportFatalUsageError`

Is there a standard way to include location information when calling reportFatalUsageError?

I have a specific MachineInstr (and, therefore, Function) that I’d like to blame. I know that I can call getDebugLoc, but I don’t know if there’s a way to convert that into a standard format to prepend to the error message.

What kind of error are you trying to report? Note that reportFatalUsageError is a “you are holding LLVM wrong” level error. If you want to report user-visible diagnostics from the backend, the way to do it is the DiagnosticInfo infrastructure, and that does come with support for diagnostic locations.

1 Like

Ah, I was unaware of the DiagnosticInfo stuff, seems like that is the correct tool to use. Thanks!