[llvm] r201985 - MCAsmParser: handle space properly for .ifc/.ifnc

Saleem Abdulrasool compnerd at compnerd.org
Sun Feb 23 07:53:36 PST 2014


Author: compnerd
Date: Sun Feb 23 09:53:36 2014
New Revision: 201985

URL: http://llvm.org/viewvc/llvm-project?rev=201985&view=rev
Log:
MCAsmParser: handle space properly for .ifc/.ifnc

If the strings are not quoted, the first string stops at the first comma, and
the second string stops at the end of the line.  Strings which contain
whitespace should be quoted.  Unquoted space is to be discarded.

Modified:
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp
    llvm/trunk/test/MC/AsmParser/ifc.s

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=201985&r1=201984&r2=201985&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Sun Feb 23 09:53:36 2014
@@ -3813,6 +3813,7 @@ bool AsmParser::parseDirectiveIfb(SMLoc
 
 /// parseDirectiveIfc
 /// ::= .ifc string1, string2
+/// ::= .ifnc string1, string2
 bool AsmParser::parseDirectiveIfc(SMLoc DirectiveLoc, bool ExpectEqual) {
   TheCondStack.push_back(TheCondState);
   TheCondState.TheCond = AsmCond::IfCond;
@@ -3834,7 +3835,7 @@ bool AsmParser::parseDirectiveIfc(SMLoc
 
     Lex();
 
-    TheCondState.CondMet = ExpectEqual == (Str1 == Str2);
+    TheCondState.CondMet = ExpectEqual == (Str1.trim() == Str2.trim());
     TheCondState.Ignore = !TheCondState.CondMet;
   }
 

Modified: llvm/trunk/test/MC/AsmParser/ifc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/ifc.s?rev=201985&r1=201984&r2=201985&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/ifc.s (original)
+++ llvm/trunk/test/MC/AsmParser/ifc.s Sun Feb 23 09:53:36 2014
@@ -63,3 +63,8 @@
 .else
 	.byte 0
 .endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifnc equal, equal ; .byte 0 ; .else ; .byte 1 ; .endif
+





More information about the llvm-commits mailing list