]> granicus.if.org Git - clang/commit
When forming the !srcloc mdnode for an inline asm, add the SourceLocations
authorChris Lattner <sabre@nondot.org>
Wed, 17 Nov 2010 08:25:26 +0000 (08:25 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 17 Nov 2010 08:25:26 +0000 (08:25 +0000)
commit5d93653247eeedaff5f0712178953b63d71a0b3b
tree4076073337446e6be51ad714213c6e08e07c749f
parent063e47667c583433548e3c40a3003bc1aac8cf78
When forming the !srcloc mdnode for an inline asm, add the SourceLocations
of all the lines of the inline asm.  With the refactoring and enhancement
of the backend, we can now reports errors on the correct source line when
an asm contains multiple lines of text.  For something like this:

void foo() {
  asm("push %rax\n"
      ".code32\n");
}

we used to get this: (note that the line 4 in t.c isn't helpful)

t.c:4:7: error: warning: ignoring directive for now
  asm("push %rax\n"
      ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

now we get:

t.c:5:8: error: warning: ignoring directive for now
      ".code32\n"
       ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

Note that we're pointing to line 5 properly now.  This implements
rdar://7839391 - inline asm errors should point to the right line in the asm
and makes the error message in PR8595 much less confusing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119489 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGStmt.cpp