forked from OSchip/llvm-project
[MC] Fix lexing ordering in assembly label parsing to preserve same line
comment placement. llvm-svn: 275265
This commit is contained in:
parent
2931b21286
commit
8ea792db60
|
@ -1501,6 +1501,12 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
|
||||||
if (!Sym->isUndefined() || Sym->isVariable())
|
if (!Sym->isUndefined() || Sym->isVariable())
|
||||||
return Error(IDLoc, "invalid symbol redefinition");
|
return Error(IDLoc, "invalid symbol redefinition");
|
||||||
|
|
||||||
|
// Consume any end of statement token, if present, to avoid spurious
|
||||||
|
// AddBlankLine calls().
|
||||||
|
if (getTok().is(AsmToken::EndOfStatement)) {
|
||||||
|
Lex();
|
||||||
|
}
|
||||||
|
|
||||||
// Emit the label.
|
// Emit the label.
|
||||||
if (!ParsingInlineAsm)
|
if (!ParsingInlineAsm)
|
||||||
Out.EmitLabel(Sym);
|
Out.EmitLabel(Sym);
|
||||||
|
@ -1513,13 +1519,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
|
||||||
|
|
||||||
getTargetParser().onLabelParsed(Sym);
|
getTargetParser().onLabelParsed(Sym);
|
||||||
|
|
||||||
// Consume any end of statement token, if present, to avoid spurious
|
|
||||||
// AddBlankLine calls().
|
|
||||||
if (Lexer.is(AsmToken::EndOfStatement)) {
|
|
||||||
Lex();
|
|
||||||
if (Lexer.is(AsmToken::Eof))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#RUN: diff %s %t
|
#RUN: diff %s %t
|
||||||
.text
|
.text
|
||||||
|
|
||||||
|
foo: #Comment here
|
||||||
|
#comment here
|
||||||
nop
|
nop
|
||||||
#if DIRECTIVE COMMENT
|
#if DIRECTIVE COMMENT
|
||||||
## WHOLE LINE COMMENT
|
## WHOLE LINE COMMENT
|
||||||
|
|
Loading…
Reference in New Issue