diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2013-09-19 00:41:32 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2013-09-19 00:41:32 +0000 |
commit | 0834a4b90139341eacdfff167b052595a95cf2e5 (patch) | |
tree | faeeee0d2c1fa35cfaf80c16b4e4ff862e749a85 /clang/lib/Frontend/VerifyDiagnosticConsumer.cpp | |
parent | 5cc15addbec0797e8c8e2b8dc099415762b4b8de (diff) | |
download | bcm5719-llvm-0834a4b90139341eacdfff167b052595a95cf2e5.tar.gz bcm5719-llvm-0834a4b90139341eacdfff167b052595a95cf2e5.zip |
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>
llvm-svn: 190980
Diffstat (limited to 'clang/lib/Frontend/VerifyDiagnosticConsumer.cpp')
-rw-r--r-- | clang/lib/Frontend/VerifyDiagnosticConsumer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp index f5555291a83..045e60add1f 100644 --- a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp +++ b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -555,7 +555,7 @@ static bool findDirectives(SourceManager &SM, FileID FID, VerifyDiagnosticConsumer::DirectiveStatus Status = VerifyDiagnosticConsumer::HasNoDirectives; while (Tok.isNot(tok::eof)) { - RawLex.Lex(Tok); + RawLex.LexFromRawLexer(Tok); if (!Tok.is(tok::comment)) continue; std::string Comment = RawLex.getSpelling(Tok, SM, LangOpts); |