Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Modules / implicit-module-header-maps.cpp
blobbd4aeb640fb3cbafd7ae4b763eda806340374ed2
1 // UNSUPPORTED: system-windows
2 // RUN: rm -rf %t
3 // RUN: split-file %s %t
4 // RUN: cd %t
5 //
6 // RUN: %hmaptool write a.hmap.json hmap
7 //
8 // RUN: %clang -Rmodule-build -fmodules -fimplicit-modules -fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap -fmodules-cache-path=%t test.cpp
9 //
10 // RUN: cd %T
11 // RUN: rm -rf %t
12 // RUN: split-file %s %t
13 // RUN: cd %t
15 // RUN: sed -e "s|OUTPUTS_DIR|%t|g" b.hmap.json > hmap.json
16 // RUN: %hmaptool write hmap.json hmap
18 // RUN: %clang -Rmodule-build -fmodules -fimplicit-modules -fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap -fmodules-cache-path=%t test.cpp
20 //--- After/Mapping.h
21 #ifdef FOO
22 #error foo
23 #endif
25 //--- a.hmap.json
27 "mappings" :
29 "Before/Mapping.h" : "After/Mapping.h",
30 "After/Mapping.h" : "After/Mapping.h"
34 //--- b.hmap.json
36 "mappings" :
38 "Before/Mapping.h" : "OUTPUTS_DIR/After/Mapping.h"
42 //--- module.modulemap
43 module a {
44 header "After/Mapping.h"
48 //--- test.cpp
49 #define FOO
50 // This include will fail if:
51 // 1) modules are't used, as the `FOO` define will propagate into the included
52 // header and trip a `#error`, or
53 // 2) header maps aren't used, as the header name doesn't exist and relies on
54 // the header map to remap it to the real header.
55 #include "Before/Mapping.h"