[libclang] Fix crash when code-completing a macro invocation that
reached EOF and did not expand the argument into the source context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170980 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index b7ea30e..8ba8318 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -528,6 +528,10 @@
MacroName = Tok;
return 0;
} else {
+ // Do not lose the EOF/EOD.
+ Token *Toks = new Token[1];
+ Toks[0] = Tok;
+ EnterTokenStream(Toks, 1, true, true);
break;
}
} else if (Tok.is(tok::r_paren)) {