aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/CodeGenAction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-06-15 00:03:12 +0000
committerChris Lattner <sabre@nondot.org>2010-06-15 00:03:12 +0000
commit99e14a04887570b11df90daf2e8a7adf84599b01 (patch)
treeabcebaa67bc9ccda132b2e54de84f21c056f28d5 /lib/Frontend/CodeGenAction.cpp
parentc66bcfd32b941d8008284ecae9d16d7d47c96b0b (diff)
fix the inline asm diagnostics to emit the error on the primary
source code location instead of on the note. Previously we generated: <inline asm>:1:2: error: unrecognized instruction barf ^ t.c:4:8: note: generated from here asm ("barf"); ^ Now we generate: t.c:4:8: error: unrecognized instruction asm ("barf"); ^ <inline asm>:1:2: note: instantated into assembly here barf ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105978 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CodeGenAction.cpp')
-rw-r--r--lib/Frontend/CodeGenAction.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/Frontend/CodeGenAction.cpp b/lib/Frontend/CodeGenAction.cpp
index 22b3bd416d..dce9f3d216 100644
--- a/lib/Frontend/CodeGenAction.cpp
+++ b/lib/Frontend/CodeGenAction.cpp
@@ -200,19 +200,28 @@ void BackendConsumer::InlineAsmDiagHandler2(const llvm::SMDiagnostic &D,
if (Message.startswith("error: "))
Message = Message.substr(7);
- // There are two cases: the SMDiagnostic could have a inline asm source
- // location or it might not. If it does, translate the location.
+ // If the SMDiagnostic has an inline asm source location, translate it.
FullSourceLoc Loc;
if (D.getLoc() != SMLoc())
Loc = ConvertBackendLocation(D, Context->getSourceManager());
- Diags.Report(Loc, diag::err_fe_inline_asm).AddString(Message);
+
- // This could be a problem with no clang-level source location information.
- // In this case, LocCookie is invalid. If there is source level information,
- // print an "generated from" note.
- if (LocCookie.isValid())
+ // If this problem has clang-level source location information, report the
+ // issue as being an error in the source with a note showing the instantiated
+ // code.
+ if (LocCookie.isValid()) {
Diags.Report(FullSourceLoc(LocCookie, Context->getSourceManager()),
- diag::note_fe_inline_asm_here);
+ diag::err_fe_inline_asm).AddString(Message);
+
+ if (D.getLoc().isValid())
+ Diags.Report(Loc, diag::note_fe_inline_asm_here);
+ return;
+ }
+
+ // Otherwise, report the backend error as occuring in the generated .s file.
+ // If Loc is invalid, we still need to report the error, it just gets no
+ // location info.
+ Diags.Report(Loc, diag::err_fe_inline_asm).AddString(Message);
}
//