[clang] [clang] Improve diagnostics for constraints of inline asm (NFC) (PR #96363)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 24 10:09:33 PDT 2024


efriedma-quic wrote:

In a lot of cases, we report_fatal_error because we don't actually expect users to run into the issues... indicate some internal inconsistency in the compiler, or some unsupported configuration, or something like that.  Because of this, report_fatal_error prints the standard "report a bug" crash message.   For inline asm specifically, emitError from the backend is probably best in most cases, so non-clang frontends get better diagnostics, and we don't have to duplicate code.

> In other words we have to return something wrong intentionally to continue compilation

Yes, this can be a bit tricky in some cases, but usually there's something straightforward you can do (for example, drop the inline asm stmt).  Note that we don't actually generate an output file, so it doesn't matter what you do as long as it doesn't cause something else to crash.

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


More information about the cfe-commits mailing list