From 7bb7c55a619c29f96518f4a0da57799cdef27167 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 13 May 2010 00:10:34 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103682 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCParser/AsmParser.cpp | 22 +++++++++------------- test/MC/AsmParser/directive_zerofill.s | 4 ++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 88e6e9a714e..d47273c1319 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -1344,22 +1344,18 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) { /// ::= .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 @@ bool AsmParser::ParseDirectiveDarwinZerofill() { 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"); diff --git a/test/MC/AsmParser/directive_zerofill.s b/test/MC/AsmParser/directive_zerofill.s index 4b26f9b68c7..207b8a97991 100644 --- a/test/MC/AsmParser/directive_zerofill.s +++ b/test/MC/AsmParser/directive_zerofill.s @@ -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