diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-24 07:15:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-24 07:15:46 +0000 |
commit | 40493eb6ebc7fd1090a30f62c1eb04e33ebe1100 (patch) | |
tree | 7d423c8120c11125796b26aec4867bf0b0f0e114 | |
parent | 469fdc6af3c3e6c77a2e79639f4063b6aab1e92a (diff) | |
download | bcm5719-llvm-40493eb6ebc7fd1090a30f62c1eb04e33ebe1100.tar.gz bcm5719-llvm-40493eb6ebc7fd1090a30f62c1eb04e33ebe1100.zip |
fix rdar://6816766 - Crash with function-like macro test at end of directive.
llvm-svn: 69964
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 2 | ||||
-rw-r--r-- | clang/test/Preprocessor/macro_fn.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 4d6450b9149..fff6f10fa9f 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -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; diff --git a/clang/test/Preprocessor/macro_fn.c b/clang/test/Preprocessor/macro_fn.c index 98ebaeea729..5c55c0ceed5 100644 --- a/clang/test/Preprocessor/macro_fn.c +++ b/clang/test/Preprocessor/macro_fn.c @@ -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 |