introduce a new recoverable error handling API to LLVMContext
authorChris Lattner <sabre@nondot.org>
Wed, 7 Apr 2010 23:40:44 +0000 (23:40 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 7 Apr 2010 23:40:44 +0000 (23:40 +0000)
commit38686bdffdebc09aa6fe6b8b54b34ac32c753f59
tree86a65f6c9f9b63270378b4c824fe40a3b00c57ef
parenta5ced590c95035793c2ae19bf70d6a0ed2c822a6
introduce a new recoverable error handling API to LLVMContext
and use it in one place in inline asm handling stuff.  Before
we'd generate this for an invalid modifier letter:

$ clang asm.c -c -o t.o
fatal error: error in backend: Invalid operand found in inline asm: 'abc incl    ${0:Z}'
INLINEASM <es:abc incl    ${0:Z}>, 10, %EAX<def>, 2147483657, %EAX, 14, %EFLAGS<earlyclobber,def,dead>, <!-1>

Now we generate this:

$ clang asm.c -c -o t.o
error: invalid operand in inline asm: 'incl    ${0:Z}'
asm.c:3:12: note: generated from here
  __asm__ ("incl    %Z0" : "+r" (X));
           ^
1 error generated.

This is much better but still admittedly not great ("why" is the operand
invalid??), codegen should try harder with its diagnostics :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100723 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/LLVMContext.h
lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
lib/VMCore/LLVMContext.cpp