]> granicus.if.org Git - clang/commitdiff
fix rdar://6816766 - Crash with function-like macro test at end of directive.
authorChris Lattner <sabre@nondot.org>
Fri, 24 Apr 2009 07:15:46 +0000 (07:15 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 24 Apr 2009 07:15:46 +0000 (07:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69964 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Lexer.cpp
test/Preprocessor/macro_fn.c

index 4d6450b9149b8a21b7f320adb51f89ab21a5520b..fff6f10fa9fef680acd1b0915986e0f10d083993 100644 (file)
@@ -1276,6 +1276,7 @@ unsigned Lexer::isNextPPTokenLParen() {
   
   // Save state that can be changed while lexing so that we can restore it.
   const char *TmpBufferPtr = BufferPtr;
+  bool inPPDirectiveMode = ParsingPreprocessorDirective;
   
   Token Tok;
   Tok.startToken();
@@ -1283,6 +1284,7 @@ unsigned Lexer::isNextPPTokenLParen() {
   
   // Restore state that may have changed.
   BufferPtr = TmpBufferPtr;
+  ParsingPreprocessorDirective = inPPDirectiveMode;
   
   // Restore the lexer back to non-skipping mode.
   LexingRawMode = false;
index 98ebaeea72919ca9d61416e5495bbc3f64713740..5c55c0ceed5f1e2198c1e4fb2ba2322120166267 100644 (file)
@@ -38,3 +38,9 @@ e()
 zero_dot()
 one_dot(x)  /* empty ... argument: expected-warning {{varargs argument missing, but tolerated as an extension}}  */
 one_dot()   /* empty first argument, elided ...: expected-warning {{varargs argument missing, but tolerated as an extension}} */
+
+
+/* rdar://6816766 - Crash with function-like macro test at end of directive. */
+#define E() (i == 0)
+#if E
+#endif