33 lines · cpp
1// Test macro preservation in C++20 Header Units.2 3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6// RUN: cd %t7 8// Produce a pre-processed file.9// RUN: %clang_cc1 -std=c++20 -E -xc++-user-header hu-01.h -o hu-01.iih10 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.pcm14 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=%t18 19//--- hu-01.h20#ifndef __GUARD21#define __GUARD22 23int baz(int);24#define FORTYTWO 4225 26#define SHOULD_NOT_BE_DEFINED -127#undef SHOULD_NOT_BE_DEFINED28 29#endif // __GUARD30 31// CHECK-HU: ====== C++20 Module structure ======32// CHECK-HU-NEXT: Header Unit '.{{/|\\\\?}}hu-01.h' is the Primary Module at index #133