MCAsmParser: handle space properly for .ifc/.ifnc
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 23 Feb 2014 15:53:36 +0000 (15:53 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 23 Feb 2014 15:53:36 +0000 (15:53 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201985 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp
test/MC/AsmParser/ifc.s

index d77a0fd1b6985a0c0233e7ee6385b77311feb55d..fb854c918d4660d1ccfaa706ae3cb34f18385141 100644 (file)
@@ -3813,6 +3813,7 @@ bool AsmParser::parseDirectiveIfb(SMLoc DirectiveLoc, bool ExpectBlank) {
 
 /// 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 DirectiveLoc, bool ExpectEqual) {
 
     Lex();
 
-    TheCondState.CondMet = ExpectEqual == (Str1 == Str2);
+    TheCondState.CondMet = ExpectEqual == (Str1.trim() == Str2.trim());
     TheCondState.Ignore = !TheCondState.CondMet;
   }
 
index 20e55c0a24fc2c85eb59ef6eb819b989a05f7143..24944a21e4feb581db7e332eefc55a16a7f77e87 100644 (file)
@@ -63,3 +63,8 @@
 .else
        .byte 0
 .endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifnc equal, equal ; .byte 0 ; .else ; .byte 1 ; .endif
+