aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Lex/TokenLexer.h
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2013-09-19 00:41:32 +0000
committerEli Friedman <eli.friedman@gmail.com>2013-09-19 00:41:32 +0000
commitd2f9308220af22bfc1bcd3bc2cad118dbd8be013 (patch)
tree3bff718c87a2ac543d1afd1bd223882c4795885e /include/clang/Lex/TokenLexer.h
parentdce250be480d32c9ce8a705936ac6e3c94ded2cb (diff)
Make Preprocessor::Lex non-recursive.
Before this patch, Lex() would recurse whenever the current lexer changed (e.g. upon entry into a macro). This patch turns the recursion into a loop: the various lex routines now don't return a token when the current lexer changes, and at the top level Preprocessor::Lex() now loops until it finds a token. Normally, the recursion wouldn't end up being very deep, but the recursion depth can explode in edge cases like a bunch of consecutive macros which expand to nothing (like in the testcase test/Preprocessor/macro_expand_empty.c in this patch). <rdar://problem/14569770> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190980 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/TokenLexer.h')
-rw-r--r--include/clang/Lex/TokenLexer.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/clang/Lex/TokenLexer.h b/include/clang/Lex/TokenLexer.h
index 090402a811..7c8cfd028a 100644
--- a/include/clang/Lex/TokenLexer.h
+++ b/include/clang/Lex/TokenLexer.h
@@ -136,7 +136,7 @@ public:
unsigned isNextTokenLParen() const;
/// Lex - Lex and return a token from this macro stream.
- void Lex(Token &Tok);
+ bool Lex(Token &Tok);
/// isParsingPreprocessorDirective - Return true if we are in the middle of a
/// preprocessor directive.
@@ -181,6 +181,8 @@ private:
/// macro definition.
void updateLocForMacroArgTokens(SourceLocation ArgIdSpellLoc,
Token *begin_tokens, Token *end_tokens);
+
+ void PropagateLineStartLeadingSpaceInfo(Token &Result);
};
} // end namespace clang