[llvm] 82c4153 - Revert "[AsmParser] make .ascii support spaces as separators"

Jian Cai via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 14:38:36 PST 2021


Author: Jian Cai
Date: 2021-01-13T14:38:22-08:00
New Revision: 82c4153e66fa284729da86a8d6c302d4b8cec86c

URL: https://github.com/llvm/llvm-project/commit/82c4153e66fa284729da86a8d6c302d4b8cec86c
DIFF: https://github.com/llvm/llvm-project/commit/82c4153e66fa284729da86a8d6c302d4b8cec86c.diff

LOG: Revert "[AsmParser] make .ascii support spaces as separators"

This reverts commit e0963ae274be5b071d1e1b00f5e4e019483c09e9. The change
breaks some GDB tests. Revert it while we investigate.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 98241bc76edf..42ac0b66ec2a 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3008,20 +3008,13 @@ bool AsmParser::parseAngleBracketString(std::string &Data) {
 }
 
 /// parseDirectiveAscii:
-//    ::= .ascii [ "string"+ ( , "string"+ )* ]
-///   ::= ( .asciz | .string ) [ "string" ( , "string" )* ]
+///   ::= ( .ascii | .asciz | .string ) [ "string" ( , "string" )* ]
 bool AsmParser::parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) {
   auto parseOp = [&]() -> bool {
     std::string Data;
-    if (checkForValidSection())
+    if (checkForValidSection() || parseEscapedString(Data))
       return true;
-    // Only support spaces as separators for .ascii directive for now. See the
-    // discusssion at https://reviews.llvm.org/D91460 for more details
-    do {
-      if (parseEscapedString(Data))
-        return true;
-      getStreamer().emitBytes(Data);
-    } while (!ZeroTerminated && getTok().is(AsmToken::String));
+    getStreamer().emitBytes(Data);
     if (ZeroTerminated)
       getStreamer().emitBytes(StringRef("\0", 1));
     return false;

diff  --git a/llvm/test/MC/AsmParser/directive_ascii.s b/llvm/test/MC/AsmParser/directive_ascii.s
index e34aa7a8a561..ea988879819b 100644
--- a/llvm/test/MC/AsmParser/directive_ascii.s
+++ b/llvm/test/MC/AsmParser/directive_ascii.s
@@ -48,11 +48,3 @@ TEST6:
 TEST7:
         .ascii "\x64\Xa6B"
         .ascii "\xface\x0Fe"
-
-# CHECK-LABEL: TEST8:
-# CHECK-NEXT: .byte 65
-# CHECK-NEXT: .byte 66
-# CHECK-NEXT: .byte 67
-# CHECK-NEXT: .byte 68
-TEST8:
-        .ascii "A", "B" "C", "D"


        


More information about the llvm-commits mailing list