Fix bug in .gpword directive parsing.
authorVladimir Medic <Vladimir.Medic@imgtec.com>
Wed, 13 Nov 2013 13:18:04 +0000 (13:18 +0000)
committerVladimir Medic <Vladimir.Medic@imgtec.com>
Wed, 13 Nov 2013 13:18:04 +0000 (13:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194570 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/AsmParser/MipsAsmParser.cpp
test/MC/Mips/mips_directives.s

index 7b93d751e00b3dad57cb1299f4d83a10279ccf1a..89e2b3b02276da8a2015d62ad47d4fac42168131 100644 (file)
@@ -2379,13 +2379,11 @@ bool MipsAsmParser::parseDirectiveGpWord() {
   // method to evaluate the expression.
   if (getParser().parseExpression(Value))
     return true;
-
   getParser().getStreamer().EmitGPRel32Value(Value);
-  Parser.Lex(); // Eat last token.
 
-  if (getLexer().is(AsmToken::EndOfStatement))
+  if (getLexer().isNot(AsmToken::EndOfStatement))
     return Error(getLexer().getLoc(), "unexpected token in directive");
-
+  Parser.Lex(); // Eat EndOfStatement token.
   return false;
 }
 
index 6bd690aad608200de8a8eb24b9ecb5ce27c97dc6..44e707c89452eafe3c75f341fbd8e329f2269166 100644 (file)
@@ -19,10 +19,11 @@ $BB0_2:
     .set    noat
 $JTI0_0:
     .gpword    ($BB0_2)
+
     .word 0x77fffffc
 # CHECK: $JTI0_0:
 # CHECK: .gpword ($BB0_2)
-# CHECK-NEXT:     .4byte    2013265916
+# CHECK:     .4byte    2013265916
     .set  at=$12
     .set macro
 # CHECK:   b 1332               # encoding: [0x10,0x00,0x01,0x4d]