]> granicus.if.org Git - clang/commitdiff
make PTH not crash on a null directive (# on its own line)
authorChris Lattner <sabre@nondot.org>
Sun, 19 Apr 2009 07:25:40 +0000 (07:25 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 19 Apr 2009 07:25:40 +0000 (07:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69523 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-cc/CacheTokens.cpp

index 6e2a20d98785aca1b7c1c2f7c8d655c49da6cf48..c417eb490285a23e99ebfb1aefabacf0f4faab46 100644 (file)
@@ -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)) {