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())
|
||||
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.
|
||||
if (!ParsingInlineAsm)
|
||||
Out.EmitLabel(Sym);
|
||||
|
@ -1513,13 +1519,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#RUN: diff %s %t
|
||||
.text
|
||||
|
||||
foo: #Comment here
|
||||
#comment here
|
||||
nop
|
||||
#if DIRECTIVE COMMENT
|
||||
## WHOLE LINE COMMENT
|
||||
|
|
Loading…
Reference in New Issue