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: rm -rf %t 11 // RUN: split-file %s %t 12 // RUN: cd %t 13 // 14 // RUN: sed -e "s|OUTPUTS_DIR|%t|g" b.hmap.json > hmap.json 15 // RUN: %hmaptool write hmap.json hmap 16 // 17 // 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 18 19 //--- After/Mapping.h 20 #ifdef FOO 21 #error foo 22 #endif 23 24 //--- a.hmap.json 25 { 26 "mappings" : 27 { 28 "Before/Mapping.h" : "After/Mapping.h", 29 "After/Mapping.h" : "After/Mapping.h" 30 } 31 } 32 33 //--- b.hmap.json 34 { 35 "mappings" : 36 { 37 "Before/Mapping.h" : "OUTPUTS_DIR/After/Mapping.h" 38 } 39 } 40 41 //--- module.modulemap 42 module a { 43 header "After/Mapping.h" 44 } 45 46 47 //--- test.cpp 48 #define FOO 49 // This include will fail if: 50 // 1) modules are't used, as the `FOO` define will propagate into the included 51 // header and trip a `#error`, or 52 // 2) header maps aren't used, as the header name doesn't exist and relies on 53 // the header map to remap it to the real header. 54 #include "Before/Mapping.h" 55