forked from OSchip/llvm-project
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. llvm-svn: 103682
This commit is contained in:
parent
9efef006cf
commit
8cb4728a15
|
@ -1344,22 +1344,18 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) {
|
||||||
/// ::= .zerofill segname , sectname [, identifier , size_expression [
|
/// ::= .zerofill segname , sectname [, identifier , size_expression [
|
||||||
/// , align_expression ]]
|
/// , align_expression ]]
|
||||||
bool AsmParser::ParseDirectiveDarwinZerofill() {
|
bool AsmParser::ParseDirectiveDarwinZerofill() {
|
||||||
// FIXME: Handle quoted names here.
|
StringRef Segment;
|
||||||
|
if (ParseIdentifier(Segment))
|
||||||
if (Lexer.isNot(AsmToken::Identifier))
|
|
||||||
return TokError("expected segment name after '.zerofill' directive");
|
return TokError("expected segment name after '.zerofill' directive");
|
||||||
StringRef Segment = getTok().getString();
|
|
||||||
Lex();
|
|
||||||
|
|
||||||
if (Lexer.isNot(AsmToken::Comma))
|
if (Lexer.isNot(AsmToken::Comma))
|
||||||
return TokError("unexpected token in directive");
|
return TokError("unexpected token in directive");
|
||||||
Lex();
|
Lex();
|
||||||
|
|
||||||
if (Lexer.isNot(AsmToken::Identifier))
|
StringRef Section;
|
||||||
|
if (ParseIdentifier(Section))
|
||||||
return TokError("expected section name after comma in '.zerofill' "
|
return TokError("expected section name after comma in '.zerofill' "
|
||||||
"directive");
|
"directive");
|
||||||
StringRef Section = getTok().getString();
|
|
||||||
Lex();
|
|
||||||
|
|
||||||
// If this is the end of the line all that was wanted was to create the
|
// If this is the end of the line all that was wanted was to create the
|
||||||
// the section but with no symbol.
|
// the section but with no symbol.
|
||||||
|
@ -1375,13 +1371,13 @@ bool AsmParser::ParseDirectiveDarwinZerofill() {
|
||||||
return TokError("unexpected token in directive");
|
return TokError("unexpected token in directive");
|
||||||
Lex();
|
Lex();
|
||||||
|
|
||||||
if (Lexer.isNot(AsmToken::Identifier))
|
SMLoc IDLoc = Lexer.getLoc();
|
||||||
|
StringRef IDStr;
|
||||||
|
if (ParseIdentifier(IDStr))
|
||||||
return TokError("expected identifier in directive");
|
return TokError("expected identifier in directive");
|
||||||
|
|
||||||
// handle the identifier as the key symbol.
|
// handle the identifier as the key symbol.
|
||||||
SMLoc IDLoc = Lexer.getLoc();
|
MCSymbol *Sym = CreateSymbol(IDStr);
|
||||||
MCSymbol *Sym = CreateSymbol(getTok().getString());
|
|
||||||
Lex();
|
|
||||||
|
|
||||||
if (Lexer.isNot(AsmToken::Comma))
|
if (Lexer.isNot(AsmToken::Comma))
|
||||||
return TokError("unexpected token in directive");
|
return TokError("unexpected token in directive");
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
# CHECK: .zerofill __FOO,__bar,x,1
|
# CHECK: .zerofill __FOO,__bar,x,1
|
||||||
# CHECK: .zerofill __FOO,__bar,y,8,2
|
# CHECK: .zerofill __FOO,__bar,y,8,2
|
||||||
# CHECK: .zerofill __EMPTY,__NoSymbol
|
# CHECK: .zerofill __EMPTY,__NoSymbol
|
||||||
|
# CHECK: .zerofill __DATA,__bss,"what you say?",8,3
|
||||||
TEST0:
|
TEST0:
|
||||||
.zerofill __FOO, __bar, x, 2-1
|
.zerofill __FOO, __bar, x, 2-1
|
||||||
.zerofill __FOO, __bar, y , 8 , 1+1
|
.zerofill __FOO, __bar, y , 8 , 1+1
|
||||||
.zerofill __EMPTY,__NoSymbol
|
.zerofill __EMPTY,__NoSymbol
|
||||||
|
|
||||||
|
# rdar://7965971
|
||||||
|
.zerofill __DATA, __bss, "what you say?", 8, 3
|
||||||
|
|
Loading…
Reference in New Issue