[ms-inline asm] If we parsed a statement and the opcode is valid, then it's an instru...
authorChad Rosier <mcrosier@apple.com>
Mon, 15 Oct 2012 19:08:18 +0000 (19:08 +0000)
committerChad Rosier <mcrosier@apple.com>
Mon, 15 Oct 2012 19:08:18 +0000 (19:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165955 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp
lib/Target/X86/AsmParser/X86AsmParser.cpp

index 0a8053121c85ff8fc19d2464a5867aa48450f7e6..0406ff8d446c878afae33460eaaf61aededc3a13 100644 (file)
@@ -136,9 +136,6 @@ private:
   /// ParsingInlineAsm - Are we parsing ms-style inline assembly?
   bool ParsingInlineAsm;
 
-  /// IsInstruction - Was the last parsed statement an instruction?
-  bool IsInstruction;
-
   /// ParsedOperands - The parsed operands from the last parsed statement.
   SmallVector<MCParsedAsmOperand*, 8> ParsedOperands;
 
@@ -195,7 +192,7 @@ public:
       delete ParsedOperands[i];
     ParsedOperands.clear();
   }
-  bool isInstruction() { return IsInstruction; }
+  bool isInstruction() { return Opcode != (unsigned)~0x0; }
   unsigned getOpcode() { return Opcode; }
 
   bool ParseExpression(const MCExpr *&Res);
@@ -439,7 +436,7 @@ AsmParser::AsmParser(SourceMgr &_SM, MCContext &_Ctx,
     GenericParser(new GenericAsmParser), PlatformParser(0),
     CurBuffer(0), MacrosEnabled(true), CppHashLineNumber(0),
     AssemblerDialect(~0U), IsDarwin(false), ParsingInlineAsm(false),
-    IsInstruction(false), Opcode(0) {
+    Opcode(~0x0) {
   // Save the old handler.
   SavedDiagHandler = SrcMgr.getDiagHandler();
   SavedDiagContext = SrcMgr.getDiagContext();
index 683d6949094b699b8b567895addec339587cc87a..454664e3ed1fc8c57e7322d6dc14dd9fd48dfc58 100644 (file)
@@ -1526,6 +1526,9 @@ MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
   assert(Op->isToken() && "Leading operand should always be a mnemonic!");
   ArrayRef<SMRange> EmptyRanges = ArrayRef<SMRange>();
 
+  // Clear the opcode.
+  Opcode = ~0x0;
+
   // First, handle aliases that expand to multiple instructions.
   // FIXME: This should be replaced with a real .td file alias mechanism.
   // Also, MatchInstructionImpl should actually *do* the EmitInstruction