[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / cxx20-hu-05.cpp
blob8147da72fb25532de6f965cf36fe3d02d6d436d5
1 // Test macro preservation in C++20 Header Units.
3 // RUN: rm -rf %t
4 // RUN: mkdir -p %t
5 // RUN: split-file %s %t
6 // RUN: cd %t
8 // Produce a pre-processed file.
9 // RUN: %clang_cc1 -std=c++20 -E -xc++-user-header hu-01.h -o hu-01.iih
11 // consume that to produce the heder unit.
12 // RUN: %clang_cc1 -std=c++20 -emit-header-unit \
13 // RUN: -xc++-header-unit-header-cpp-output hu-01.iih -o hu-01.pcm
15 // check that the header unit is named for the original file, not the .iih.
16 // RUN: %clang_cc1 -std=c++20 -module-file-info hu-01.pcm | \
17 // RUN: FileCheck --check-prefix=CHECK-HU %s -DTDIR=%t
19 //--- hu-01.h
20 #ifndef __GUARD
21 #define __GUARD
23 int baz(int);
24 #define FORTYTWO 42
26 #define SHOULD_NOT_BE_DEFINED -1
27 #undef SHOULD_NOT_BE_DEFINED
29 #endif // __GUARD
31 // CHECK-HU: ====== C++20 Module structure ======
32 // CHECK-HU-NEXT: Header Unit '.{{/|\\\\?}}hu-01.h' is the Primary Module at index #1