summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-01-27 00:37:08 +0000
committerJim Grosbach <grosbach@apple.com>2012-01-27 00:37:08 +0000
commitb591277c4ad3b6ca50bd61ca79fdfc4a508bc955 (patch)
tree5f95deb9a0864052aa426462418a6fd49804b984 /llvm/lib/MC/MCParser
parente284cff24ee7d686c156c60a76a9a022e7b9a891 (diff)
downloadbcm5719-llvm-b591277c4ad3b6ca50bd61ca79fdfc4a508bc955.tar.gz
bcm5719-llvm-b591277c4ad3b6ca50bd61ca79fdfc4a508bc955.zip
Better diagnostic for malformed .org assembly directive.
Provide source line number information. llvm-svn: 149101
Diffstat (limited to 'llvm/lib/MC/MCParser')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 64d0dd8563c..1af7cd9ee0d 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -1970,6 +1970,7 @@ bool AsmParser::ParseDirectiveOrg() {
CheckForValidSection();
const MCExpr *Offset;
+ SMLoc Loc = getTok().getLoc();
if (ParseExpression(Offset))
return true;
@@ -1989,9 +1990,11 @@ bool AsmParser::ParseDirectiveOrg() {
Lex();
- // FIXME: Only limited forms of relocatable expressions are accepted here, it
- // has to be relative to the current section.
- getStreamer().EmitValueToOffset(Offset, FillExpr);
+ // Only limited forms of relocatable expressions are accepted here, it
+ // has to be relative to the current section. The streamer will return
+ // 'true' if the expression wasn't evaluatable.
+ if (getStreamer().EmitValueToOffset(Offset, FillExpr))
+ return Error(Loc, "expected assembly-time absolute expression");
return false;
}
OpenPOWER on IntegriCloud