[llvm-commits] [llvm] r103682 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/directive_zerofill.s

Chris Lattner sabre at nondot.org
Wed May 12 17:10:34 PDT 2010


Author: lattner
Date: Wed May 12 19:10:34 2010
New Revision: 103682

URL: http://llvm.org/viewvc/llvm-project?rev=103682&view=rev
Log:
fix rdar://7965971 and a fixme: use ParseIdentifier in
ParseDirectiveDarwinZerofill instead of hard coding the
check for identifier. This allows quoted symbol names to
be used.


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

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=103682&r1=103681&r2=103682&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Wed May 12 19:10:34 2010
@@ -1344,22 +1344,18 @@
 ///  ::= .zerofill segname , sectname [, identifier , size_expression [
 ///      , align_expression ]]
 bool AsmParser::ParseDirectiveDarwinZerofill() {
-  // FIXME: Handle quoted names here.
-
-  if (Lexer.isNot(AsmToken::Identifier))
+  StringRef Segment;
+  if (ParseIdentifier(Segment))
     return TokError("expected segment name after '.zerofill' directive");
-  StringRef Segment = getTok().getString();
-  Lex();
 
   if (Lexer.isNot(AsmToken::Comma))
     return TokError("unexpected token in directive");
   Lex();
- 
-  if (Lexer.isNot(AsmToken::Identifier))
+
+  StringRef Section;
+  if (ParseIdentifier(Section))
     return TokError("expected section name after comma in '.zerofill' "
                     "directive");
-  StringRef Section = getTok().getString();
-  Lex();
 
   // If this is the end of the line all that was wanted was to create the
   // the section but with no symbol.
@@ -1375,13 +1371,13 @@
     return TokError("unexpected token in directive");
   Lex();
 
-  if (Lexer.isNot(AsmToken::Identifier))
+  SMLoc IDLoc = Lexer.getLoc();
+  StringRef IDStr;
+  if (ParseIdentifier(IDStr))
     return TokError("expected identifier in directive");
   
   // handle the identifier as the key symbol.
-  SMLoc IDLoc = Lexer.getLoc();
-  MCSymbol *Sym = CreateSymbol(getTok().getString());
-  Lex();
+  MCSymbol *Sym = CreateSymbol(IDStr);
 
   if (Lexer.isNot(AsmToken::Comma))
     return TokError("unexpected token in directive");

Modified: llvm/trunk/test/MC/AsmParser/directive_zerofill.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_zerofill.s?rev=103682&r1=103681&r2=103682&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_zerofill.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_zerofill.s Wed May 12 19:10:34 2010
@@ -4,7 +4,11 @@
 # CHECK: .zerofill __FOO,__bar,x,1
 # CHECK: .zerofill __FOO,__bar,y,8,2
 # CHECK: .zerofill __EMPTY,__NoSymbol
+# CHECK: .zerofill __DATA,__bss,"what you say?",8,3
 TEST0:  
 	.zerofill __FOO, __bar, x, 2-1
 	.zerofill __FOO,   __bar, y ,  8 , 1+1
 	.zerofill __EMPTY,__NoSymbol
+        
+        # rdar://7965971
+        .zerofill __DATA, __bss, "what you say?", 8, 3





More information about the llvm-commits mailing list