[llvm-commits] [llvm] r166792 - /llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
Chad Rosier
mcrosier at apple.com
Fri Oct 26 11:32:45 PDT 2012
Author: mcrosier
Date: Fri Oct 26 13:32:44 2012
New Revision: 166792
URL: http://llvm.org/viewvc/llvm-project?rev=166792&view=rev
Log:
[ms-inline asm] Emit an error for unsupported SIZE and LENGTH directives.
Part of rdar://12576868
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=166792&r1=166791&r2=166792&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Fri Oct 26 13:32:44 2012
@@ -891,7 +891,7 @@
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 @@
// 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 @@
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)) {
More information about the llvm-commits
mailing list