Skip to content

Commit

Permalink
MCAsmParser: handle space properly for .ifc/.ifnc
Browse files Browse the repository at this point in the history
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
  • Loading branch information
compnerd committed Feb 23, 2014
1 parent a0d1629 commit 0922e5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/MC/MCParser/AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
5 changes: 5 additions & 0 deletions test/MC/AsmParser/ifc.s
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,8 @@
.else
.byte 0
.endif

# CHECK-NOT: .byte 0
# CHECK: .byte 1
.ifnc equal, equal ; .byte 0 ; .else ; .byte 1 ; .endif

0 comments on commit 0922e5b

Please sign in to comment.