[Lex] Bring back the magic number 50 in updateConsecutiveMacroArgTokens.
authorHaojian Wu <hokein.wu@gmail.com>
Wed, 26 Oct 2022 09:47:44 +0000 (11:47 +0200)
committerHaojian Wu <hokein.wu@gmail.com>
Wed, 26 Oct 2022 10:03:21 +0000 (12:03 +0200)
commit11c1d8b7fd82b32b37db47bcd8eac813b9667b5c
tree37ed2ab0adbd62bd2a116c3a228e94c67bf9f885
parent1a726cfa83667585dd87a9955ed5e331cad45d18
[Lex] Bring back the magic number 50 in updateConsecutiveMacroArgTokens.

This patch is a reland of 74e4f778cf16cbf7163b5c6de6027a43f5e9169f and
f83347b0bedb22ea676861c8e4e2ed9c31371ade with the removed 50 trick back.

The magic number 50 was removed in D134942, as a behavior change for
performance reason.

While it reduces the number of SLocEntry, it increases the usage of
SourceLocation address space usage, which is critical for compiling
large TU.

This fixes a regression caused in D134942 -- clang failed to compile one of
our internal files, complaining the file is too large to process because clang
runs out of source location space (we spend 40% more address space!)

Differential Revision: https://reviews.llvm.org/D136539
clang/lib/Lex/TokenLexer.cpp
clang/test/Lexer/update_consecutive_macro_address_space.c [new file with mode: 0644]