Skip to content

Commit 9c08e19

Browse files
committed
Fix contended handling between NEAR/FAR and FRAME
1 parent b68722b commit 9c08e19

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

llvm/lib/MC/MCParser/COFFMasmParser.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ bool COFFMasmParser::parseDirectiveProc(StringRef Directive, SMLoc Loc) {
470470
ProcInfo Proc;
471471
if (getParser().parseIdentifier(Proc.Name))
472472
return Error(Loc, "expected identifier for procedure");
473-
if (getLexer().is(AsmToken::Identifier)) {
473+
while (getLexer().is(AsmToken::Identifier)) {
474474
StringRef nextVal = getTok().getString();
475475
SMLoc nextLoc = getTok().getLoc();
476476
if (nextVal.equals_insensitive("far")) {
@@ -483,6 +483,13 @@ bool COFFMasmParser::parseDirectiveProc(StringRef Directive, SMLoc Loc) {
483483
Proc.Distance = PROC_DISTANCE_NEAR;
484484
nextVal = getTok().getString();
485485
nextLoc = getTok().getLoc();
486+
} else if (nextVal.equals_insensitive("frame")) {
487+
Lex();
488+
Proc.IsFramed = true;
489+
nextVal = getTok().getString();
490+
nextLoc = getTok().getLoc();
491+
} else {
492+
break;
486493
}
487494
}
488495
MCSymbolCOFF *Sym =
@@ -498,12 +505,6 @@ bool COFFMasmParser::parseDirectiveProc(StringRef Directive, SMLoc Loc) {
498505
? MCContext::IsNear
499506
: MCContext::IsFar);
500507

501-
if (getLexer().is(AsmToken::Identifier) &&
502-
getTok().getString().equals_insensitive("frame")) {
503-
Lex();
504-
Proc.IsFramed = true;
505-
getStreamer().emitWinCFIStartProc(Sym, Loc);
506-
}
507508
if (Proc.IsFramed) {
508509
getStreamer().emitWinCFIStartProc(Sym, Loc);
509510
}

0 commit comments

Comments
 (0)