Revert r277408 and r277407
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Tue, 2 Aug 2016 02:53:59 +0000 (02:53 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Tue, 2 Aug 2016 02:53:59 +0000 (02:53 +0000)
Revert r277408 "Fix test from rL277407."
Revert r277407 "[MC] Fix handling of end-of-line preprocessor comments"

This is currently breaking:
  http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/20731

llvm-svn: 277412

llvm/lib/MC/MCParser/AsmParser.cpp
llvm/test/MC/ARM/preserve-comments-arm.s [deleted file]

index 6d3240a..d85f1c6 100644 (file)
@@ -262,23 +262,9 @@ public:
     return false;
   }
 
-  bool parseEOL(const Twine &ErrMsg) {
-    if (getTok().getKind() == AsmToken::Hash) {
-      StringRef CommentStr = parseStringToEndOfStatement();
-      Lexer.Lex();
-      Lexer.UnLex(AsmToken(AsmToken::EndOfStatement, CommentStr));
-    }
-    if (getTok().getKind() != AsmToken::EndOfStatement)
-      return TokError(ErrMsg);
-    Lex();
-    return false;
-  }
-
   /// parseToken - If current token has the specified kind, eat it and
   /// return success.  Otherwise, emit the specified error and return failure.
   bool parseToken(AsmToken::TokenKind T, const Twine &ErrMsg) {
-    if (T == AsmToken::EndOfStatement)
-      return parseEOL(ErrMsg);
     if (getTok().getKind() != T)
       return TokError(ErrMsg);
     Lex();
@@ -1423,16 +1409,6 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
     Lex();
     return false;
   }
-  if (Lexer.is(AsmToken::Hash)) {
-    // Seeing a hash here means that it was an end-of-line comment in
-    // an asm syntax where hash's are not comment and the previous
-    // statement parser did not check the end of statement. Relex as
-    // EndOfStatement.
-    StringRef CommentStr = parseStringToEndOfStatement();
-    Lexer.Lex();
-    Lexer.UnLex(AsmToken(AsmToken::EndOfStatement, CommentStr));
-    return false;
-  }
   // Statements always start with an identifier.
   AsmToken ID = getTok();
   SMLoc IDLoc = ID.getLoc();
@@ -1566,16 +1542,6 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
     if (!Sym->isUndefined() || Sym->isVariable())
       return Error(IDLoc, "invalid symbol redefinition");
 
-    // End of Labels should be treated as end of line for lexing
-    // purposes but that information is not available to the Lexer who
-    // does not understand Labels. This may cause us to see a Hash
-    // here instead of a preprocessor line comment.
-    if (getTok().is(AsmToken::Hash)) {
-      StringRef CommentStr = parseStringToEndOfStatement();
-      Lexer.Lex();
-      Lexer.UnLex(AsmToken(AsmToken::EndOfStatement, CommentStr));
-    }
-
     // Consume any end of statement token, if present, to avoid spurious
     // AddBlankLine calls().
     if (getTok().is(AsmToken::EndOfStatement)) {
diff --git a/llvm/test/MC/ARM/preserve-comments-arm.s b/llvm/test/MC/ARM/preserve-comments-arm.s
deleted file mode 100644 (file)
index a44a20c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-       @RUN: llvm-mc -preserve-comments -n -triple arm-eabi < %s > %t
-       @RUN: sed 's/[\t]#/     @/g' %s > %t2
-       @RUN: diff %t %t2
-       .text
-
-       mov     r0, r0
-foo:   #Comment here
-       mov     r0, r0  @ EOL comment
-       .ident  ""
-