llvm-mc: Use AddBlankLine in asm parser. This makes transliteration match the input...
authorDaniel Dunbar <daniel@zuster.org>
Sun, 23 May 2010 18:36:34 +0000 (18:36 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 23 May 2010 18:36:34 +0000 (18:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104466 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp

index 0134519177190e364daf2f400fc273b9771279c0..0d6eaec35fb355e6ffe14a46a856d47392714c39 100644 (file)
@@ -432,6 +432,7 @@ bool AsmParser::ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res,
 ///   ::= Label* Identifier OperandList* EndOfStatement
 bool AsmParser::ParseStatement() {
   if (Lexer.is(AsmToken::EndOfStatement)) {
+    Out.AddBlankLine();
     Lex();
     return false;
   }
@@ -506,6 +507,14 @@ bool AsmParser::ParseStatement() {
     // Emit the label.
     Out.EmitLabel(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 ParseStatement();
   }