From 0922e5b6430a566ed9f6d814902065352126faa5 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 23 Feb 2014 15:53:36 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201985 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCParser/AsmParser.cpp | 3 ++- test/MC/AsmParser/ifc.s | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index d77a0fd1b69..fb854c918d4 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -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; } diff --git a/test/MC/AsmParser/ifc.s b/test/MC/AsmParser/ifc.s index 20e55c0a24f..24944a21e4f 100644 --- a/test/MC/AsmParser/ifc.s +++ b/test/MC/AsmParser/ifc.s @@ -63,3 +63,8 @@ .else .byte 0 .endif + +# CHECK-NOT: .byte 0 +# CHECK: .byte 1 +.ifnc equal, equal ; .byte 0 ; .else ; .byte 1 ; .endif +