Skip to content
Snippets Groups Projects
  • Eli Friedman's avatar
    d2f93082
    Make Preprocessor::Lex non-recursive. · d2f93082
    Eli Friedman authored
    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
    d2f93082
    History
    Make Preprocessor::Lex non-recursive.
    Eli Friedman authored
    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
Code owners
Assign users and groups as approvers for specific file changes. Learn more.