[cfe-commits] r69964 - in /cfe/trunk: lib/Lex/Lexer.cpp test/Preprocessor/macro_fn.c

Chris Lattner sabre at nondot.org
Fri Apr 24 00:15:46 PDT 2009


Author: lattner
Date: Fri Apr 24 02:15:46 2009
New Revision: 69964

URL: http://llvm.org/viewvc/llvm-project?rev=69964&view=rev
Log:
fix rdar://6816766 - Crash with function-like macro test at end of directive.

Modified:
    cfe/trunk/lib/Lex/Lexer.cpp
    cfe/trunk/test/Preprocessor/macro_fn.c

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=69964&r1=69963&r2=69964&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Fri Apr 24 02:15:46 2009
@@ -1276,6 +1276,7 @@
   
   // 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 @@
   
   // Restore state that may have changed.
   BufferPtr = TmpBufferPtr;
+  ParsingPreprocessorDirective = inPPDirectiveMode;
   
   // Restore the lexer back to non-skipping mode.
   LexingRawMode = false;

Modified: cfe/trunk/test/Preprocessor/macro_fn.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/macro_fn.c?rev=69964&r1=69963&r2=69964&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/macro_fn.c (original)
+++ cfe/trunk/test/Preprocessor/macro_fn.c Fri Apr 24 02:15:46 2009
@@ -38,3 +38,9 @@
 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





More information about the cfe-commits mailing list