[cfe-commits] r66606 - in /cfe/trunk/lib: AST/Stmt.cpp Sema/SemaStmt.cpp
Chris Lattner
sabre at nondot.org
Tue Mar 10 16:57:07 PDT 2009
Author: lattner
Date: Tue Mar 10 18:57:07 2009
New Revision: 66606
URL: http://llvm.org/viewvc/llvm-project?rev=66606&view=rev
Log:
position the caret properly on asm string diagnostics, e.g.:
Sema/asm.c:64:9: error: invalid % escape in inline assembly string
asm("%!" : ); // expected-error {{invalid % escape in inline assembly string}}
~~^~
Modified:
cfe/trunk/lib/AST/Stmt.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=66606&r1=66605&r2=66606&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Tue Mar 10 18:57:07 2009
@@ -288,7 +288,7 @@
continue;
}
- DiagOffs = CurPtr-StrStart;
+ DiagOffs = CurPtr-StrStart-1;
return diag::err_asm_invalid_escape;
}
}
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=66606&r1=66605&r2=66606&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Tue Mar 10 18:57:07 2009
@@ -967,9 +967,8 @@
llvm::SmallVector<AsmStmt::AsmStringPiece, 8> Pieces;
unsigned DiagOffs;
if (unsigned DiagID = NS->AnalyzeAsmString(Pieces, Context, DiagOffs)) {
- // FIXME: get offsets in strings working.
- // StringLiteralParser::getOffsetOfStringByte
- Diag(AsmString->getLocStart(), DiagID) << AsmString->getSourceRange();
+ Diag(getLocationOfStringLiteralByte(AsmString, DiagOffs), DiagID)
+ << AsmString->getSourceRange();
DeleteStmt(NS);
return StmtError();
}
More information about the cfe-commits
mailing list