summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenAction.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-10-16 10:48:28 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-10-16 10:48:28 +0000
commite06b2b7012de1c04c746df1c1ced0eefe23f42d5 (patch)
tree737c321736c73498b508a32188be7ec7f6859244 /clang/lib/CodeGen/CodeGenAction.cpp
parentbc25b6eb67955a48f012e1cca50a08cc83685182 (diff)
downloadbcm5719-llvm-e06b2b7012de1c04c746df1c1ced0eefe23f42d5.tar.gz
bcm5719-llvm-e06b2b7012de1c04c746df1c1ced0eefe23f42d5.zip
Convert inline asm source ranges into clang SourceRanges and print them with the instantiated note.
t.c:2:7: error: invalid operand for instruction asm("movl 0(%rax), 0(%edx)"); ^ <inline asm>:1:16: note: instantiated into assembly here movl 0(%rax), 0(%edx) ^~~~~~~ 1 error generated. llvm-svn: 142131
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenAction.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index 68dd5c94dc0..11d6075582f 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -215,8 +215,17 @@ void BackendConsumer::InlineAsmDiagHandler2(const llvm::SMDiagnostic &D,
if (LocCookie.isValid()) {
Diags.Report(LocCookie, diag::err_fe_inline_asm).AddString(Message);
- if (D.getLoc().isValid())
- Diags.Report(Loc, diag::note_fe_inline_asm_here);
+ if (D.getLoc().isValid()) {
+ DiagnosticBuilder B = Diags.Report(Loc, diag::note_fe_inline_asm_here);
+ // Convert the SMDiagnostic ranges into SourceRange and attach them
+ // to the diagnostic.
+ for (unsigned i = 0, e = D.getRanges().size(); i != e; ++i) {
+ std::pair<unsigned, unsigned> Range = D.getRanges()[i];
+ unsigned Column = D.getColumnNo();
+ B << SourceRange(Loc.getLocWithOffset(Range.first - Column),
+ Loc.getLocWithOffset(Range.second - Column));
+ }
+ }
return;
}
OpenPOWER on IntegriCloud