aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/AsmParser/X86AsmParser.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-10-26 18:32:44 +0000
committerChad Rosier <mcrosier@apple.com>2012-10-26 18:32:44 +0000
commit7ab21c7a05509714358ac26530f5427de63113df (patch)
tree9dc97613ba6ca221ef9c15bb3c85e89abec671c8 /lib/Target/X86/AsmParser/X86AsmParser.cpp
parentefcb3d9c1cd9410949b4005fbe6f2817f8dfe395 (diff)
[ms-inline asm] Emit an error for unsupported SIZE and LENGTH directives.
Part of rdar://12576868 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166792 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmParser/X86AsmParser.cpp')
-rw-r--r--lib/Target/X86/AsmParser/X86AsmParser.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 87abfd2241..0e0ddcfcee 100644
--- a/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -891,7 +891,7 @@ X86Operand *X86AsmParser::ParseIntelOffsetOfOperator(SMLoc Start) {
SMLoc End;
const MCExpr *Val;
if (getParser().ParseExpression(Val, End))
- return 0;
+ return ErrorOperand(Start, "Unable to parse expression!");
End = Parser.getTok().getLoc();
@@ -928,7 +928,7 @@ X86Operand *X86AsmParser::ParseIntelTypeOperator(SMLoc Start) {
// identifier.
// FIXME: Pass a valid SMLoc.
if (!SemaCallback->LookupInlineAsmIdentifier(Sym.getName(), NULL, Size))
- return ErrorOperand(Start, "Unable to lookup TYPE of expr.");
+ return ErrorOperand(Start, "Unable to lookup TYPE of expr!");
Size /= 8; // Size is in terms of bits, but we want bytes in the context.
}
@@ -946,16 +946,22 @@ X86Operand *X86AsmParser::ParseIntelOperand() {
SMLoc Start = Parser.getTok().getLoc(), End;
// offset operator.
- const AsmToken &Tok = Parser.getTok();
- if ((Tok.getString() == "offset" || Tok.getString() == "OFFSET") &&
+ StringRef AsmTokStr = Parser.getTok().getString();
+ if ((AsmTokStr == "offset" || AsmTokStr == "OFFSET") &&
isParsingInlineAsm())
return ParseIntelOffsetOfOperator(Start);
// Type directive.
- if ((Tok.getString() == "type" || Tok.getString() == "TYPE") &&
+ if ((AsmTokStr == "type" || AsmTokStr == "TYPE") &&
isParsingInlineAsm())
return ParseIntelTypeOperator(Start);
+ // Unsupported directives.
+ if (isParsingIntelSyntax() &&
+ (AsmTokStr == "size" || AsmTokStr == "SIZE" ||
+ AsmTokStr == "length" || AsmTokStr == "LENGTH"))
+ return ErrorOperand(Start, "Unsupported directive!");
+
// immediate.
if (getLexer().is(AsmToken::Integer) || getLexer().is(AsmToken::Real) ||
getLexer().is(AsmToken::Minus)) {