If we see an invalid #ifdef  directive, enter a conditional compilation region
so that we don't emit an error on the #endif.  Suggestion by Neil.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42258 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Lex/Preprocessor.cpp b/Lex/Preprocessor.cpp
index b51222c..f43eae1 100644
--- a/Lex/Preprocessor.cpp
+++ b/Lex/Preprocessor.cpp
@@ -2121,8 +2121,13 @@
   ReadMacroName(MacroNameTok);
   
   // Error reading macro name?  If so, diagnostic already issued.
-  if (MacroNameTok.getKind() == tok::eom)
+  if (MacroNameTok.getKind() == tok::eom) {
+    // Skip code until we get to #endif.  This helps with recovery by not
+    // emitting an error when the #endif is reached.
+    SkipExcludedConditionalBlock(DirectiveTok.getLocation(),
+                                 /*Foundnonskip*/false, /*FoundElse*/false);
     return;
+  }
   
   // Check to see if this is the last token on the #if[n]def line.
   CheckEndOfDirective(isIfndef ? "#ifndef" : "#ifdef");