Skip to content

Commit e2c5b95

Browse files
authored
[ms] [llvm-ml] Remove space-separated argument support (llvm#132750)
This leads to errors when parsing MASM macro calls, and was retained from AsmParser by mistake. Fixes llvm#132074
1 parent c7e6ee7 commit e2c5b95

File tree

1 file changed

+2
-54
lines changed

1 file changed

+2
-54
lines changed

llvm/lib/MC/MCParser/MasmParser.cpp

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,6 @@ class MasmParser : public MCAsmParser {
450450
/// Defaults to 1U, meaning Intel.
451451
unsigned AssemblerDialect = 1U;
452452

453-
/// is Darwin compatibility enabled?
454-
bool IsDarwin = false;
455-
456453
/// Are we parsing ms-style inline assembly?
457454
bool ParsingMSInlineAsm = false;
458455

@@ -2589,24 +2586,6 @@ static bool isOperator(AsmToken::TokenKind kind) {
25892586
}
25902587
}
25912588

2592-
namespace {
2593-
2594-
class AsmLexerSkipSpaceRAII {
2595-
public:
2596-
AsmLexerSkipSpaceRAII(AsmLexer &Lexer, bool SkipSpace) : Lexer(Lexer) {
2597-
Lexer.setSkipSpace(SkipSpace);
2598-
}
2599-
2600-
~AsmLexerSkipSpaceRAII() {
2601-
Lexer.setSkipSpace(true);
2602-
}
2603-
2604-
private:
2605-
AsmLexer &Lexer;
2606-
};
2607-
2608-
} // end anonymous namespace
2609-
26102589
bool MasmParser::parseMacroArgument(const MCAsmMacroParameter *MP,
26112590
MCAsmMacroArgument &MA,
26122591
AsmToken::TokenKind EndTok) {
@@ -2633,43 +2612,12 @@ bool MasmParser::parseMacroArgument(const MCAsmMacroParameter *MP,
26332612

26342613
unsigned ParenLevel = 0;
26352614

2636-
// Darwin doesn't use spaces to delmit arguments.
2637-
AsmLexerSkipSpaceRAII ScopedSkipSpace(Lexer, IsDarwin);
2638-
2639-
bool SpaceEaten;
2640-
26412615
while (true) {
2642-
SpaceEaten = false;
26432616
if (Lexer.is(AsmToken::Eof) || Lexer.is(AsmToken::Equal))
26442617
return TokError("unexpected token");
26452618

2646-
if (ParenLevel == 0) {
2647-
if (Lexer.is(AsmToken::Comma))
2648-
break;
2649-
2650-
if (Lexer.is(AsmToken::Space)) {
2651-
SpaceEaten = true;
2652-
Lex(); // Eat spaces.
2653-
}
2654-
2655-
// Spaces can delimit parameters, but could also be part an expression.
2656-
// If the token after a space is an operator, add the token and the next
2657-
// one into this argument
2658-
if (!IsDarwin) {
2659-
if (isOperator(Lexer.getKind()) && Lexer.isNot(EndTok)) {
2660-
MA.push_back(getTok());
2661-
Lex();
2662-
2663-
// Whitespace after an operator can be ignored.
2664-
if (Lexer.is(AsmToken::Space))
2665-
Lex();
2666-
2667-
continue;
2668-
}
2669-
}
2670-
if (SpaceEaten)
2671-
break;
2672-
}
2619+
if (ParenLevel == 0 && Lexer.is(AsmToken::Comma))
2620+
break;
26732621

26742622
// handleMacroEntry relies on not advancing the lexer here
26752623
// to be able to fill in the remaining default parameter values

0 commit comments

Comments
 (0)