From: Chris Lattner Date: Sun, 19 Apr 2009 07:25:40 +0000 (+0000) Subject: make PTH not crash on a null directive (# on its own line) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2135619d9302224d26292906d286d6bdaa9ab0f2;p=clang make PTH not crash on a null directive (# on its own line) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69523 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/clang-cc/CacheTokens.cpp b/tools/clang-cc/CacheTokens.cpp index 6e2a20d987..c417eb4902 100644 --- a/tools/clang-cc/CacheTokens.cpp +++ b/tools/clang-cc/CacheTokens.cpp @@ -475,8 +475,10 @@ PTHEntry PTHWriter::LexTokens(Lexer& L) { // Get the next token. L.LexFromRawLexer(Tok); - - assert(!Tok.isAtStartOfLine()); + + // If we see the start of line, then we had a null directive "#". + if (Tok.isAtStartOfLine()) + goto NextToken; // Did we see 'include'/'import'/'include_next'? if (Tok.isNot(tok::identifier)) {