aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2013-01-22 21:09:20 +0000
committerKevin Enderby <enderby@apple.com>2013-01-22 21:09:20 +0000
commit5de048ec30f9ef9f56c89f9fdb50022beca6ae88 (patch)
treecd9242ccebb7dfdb981b11b2426093ef4f85825a /lib/MC
parentbf6a77b98715012c0fa3bdbb3ba55fa7c24c1548 (diff)
downloadexternal_llvm-5de048ec30f9ef9f56c89f9fdb50022beca6ae88.zip
external_llvm-5de048ec30f9ef9f56c89f9fdb50022beca6ae88.tar.gz
external_llvm-5de048ec30f9ef9f56c89f9fdb50022beca6ae88.tar.bz2
Have the integrated assembler give an error if $1 is used as an identifier in
an expression. Currently this bug causes the line to be ignored in a release build and an assert in a debug build. rdar://13062484 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173195 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 7d4b4d8..b5f51d8 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/lib/MC/MCParser/AsmParser.cpp
@@ -734,7 +734,9 @@ bool AsmParser::ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc) {
/// primaryexpr ::= '.'
/// primaryexpr ::= ~,+,- primaryexpr
bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
- switch (Lexer.getKind()) {
+ SMLoc FirstTokenLoc = getLexer().getLoc();
+ AsmToken::TokenKind FirstTokenKind = Lexer.getKind();
+ switch (FirstTokenKind) {
default:
return TokError("unknown token in expression");
// If we have an error assume that we've already handled it.
@@ -750,8 +752,11 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
case AsmToken::String:
case AsmToken::Identifier: {
StringRef Identifier;
- if (ParseIdentifier(Identifier))
+ if (ParseIdentifier(Identifier)) {
+ if (FirstTokenKind == AsmToken::Dollar)
+ return Error(FirstTokenLoc, "invalid token in expression");
return true;
+ }
EndLoc = SMLoc::getFromPointer(Identifier.end());