llvm-project/clang/test/Lexer/update_consecutive_macro_address_space.c
Haojian Wu 11c1d8b7fd [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
2022-10-26 12:03:21 +02:00

37 lines
2.4 KiB
C

// RUN: %clang -cc1 -print-stats %s 2>&1 | FileCheck %s
// CHECK: 6 local SLocEntry's allocated
//
// Verify that the macro arg expansion is split to two file ids, we have 6 file
// ids rather than 5:
// 0: invalid file id
// 1: main file
// 2: builtin file
// 3: macro expansion for X
// 4: macro arg expansions for 1
// 5: macro arg expansions for == 2
#define X(x) (int)(x);
void func() {
X(1
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
== 2);
}