AsmParser: Add support for .ifc and .ifnc directives.
[oota-llvm.git] / lib / MC / MCParser / AsmLexer.cpp
index e446a83a58b27ad15e3d7a4b28de84fc1c1bbb21..c76052d66e0025ecc56d508e70ba6979dc3de3dc 100644 (file)
@@ -375,8 +375,15 @@ AsmToken AsmLexer::LexToken() {
     return AsmToken(AsmToken::EndOfStatement,
                     StringRef(TokStart, strlen(MAI.getSeparatorString())));
   }
-  isAtStartOfLine = false;
 
+  // If we're missing a newline at EOF, make sure we still get an
+  // EndOfStatement token before the Eof token.
+  if (CurChar == EOF && !isAtStartOfLine) {
+    isAtStartOfLine = true;
+    return AsmToken(AsmToken::EndOfStatement, StringRef(TokStart, 1));
+  }
+
+  isAtStartOfLine = false;
   switch (CurChar) {
   default:
     // Handle identifier: [a-zA-Z_.][a-zA-Z0-9_$.@]*