1 // Test macro preservation in C++20 Header Units. 2 3 // RUN: rm -rf %t 4 // RUN: mkdir -p %t 5 // RUN: split-file %s %t 6 // RUN: cd %t 7 8 // Produce a pre-processed file. 9 // RUN: %clang_cc1 -std=c++20 -E -xc++-user-header hu-01.h -o hu-01.iih 10 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 14 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 18 19 //--- hu-01.h 20 #ifndef __GUARD 21 #define __GUARD 22 23 int baz(int); 24 #define FORTYTWO 42 25 26 #define SHOULD_NOT_BE_DEFINED -1 27 #undef SHOULD_NOT_BE_DEFINED 28 29 #endif // __GUARD 30 31 // CHECK-HU: ====== C++20 Module structure ====== 32 // CHECK-HU-NEXT: Header Unit '.{{/|\\\\?}}hu-01.h' is the Primary Module at index #1 33