brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · dfbc33c Raw
59 lines · cpp
1// UNSUPPORTED: system-windows2// RUN: cd %S3// RUN: rm -rf %t4// RUN: mkdir %t5// RUN: split-file %s %t6// RUN: cd %t7//8// RUN: %hmaptool write a.hmap.json hmap9//10// RUN: %clang -Rmodule-build -fmodules -fimplicit-modules -fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap -fmodules-cache-path=%t test.cpp11//12// RUN: cd %S13// RUN: rm -rf %t14// RUN: mkdir %t15// RUN: split-file %s %t16// RUN: cd %t17//18// RUN: sed -e "s|OUTPUTS_DIR|%t|g" b.hmap.json > hmap.json19// RUN: %hmaptool write hmap.json hmap20//21// RUN: %clang -Rmodule-build -fmodules -fimplicit-modules -fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap -fmodules-cache-path=%t test.cpp22 23//--- After/Mapping.h24#ifdef FOO25#error foo26#endif27 28//--- a.hmap.json29{30  "mappings" :31    {32     "Before/Mapping.h" : "After/Mapping.h",33     "After/Mapping.h" : "After/Mapping.h"34    }35}36 37//--- b.hmap.json38{39  "mappings" :40    {41     "Before/Mapping.h" : "OUTPUTS_DIR/After/Mapping.h"42    }43}44 45//--- module.modulemap46module a {47  header "After/Mapping.h"48}49 50 51//--- test.cpp52#define FOO53// This include will fail if:54// 1) modules are't used, as the `FOO` define will propagate into the included55//    header and trip a `#error`, or56// 2) header maps aren't used, as the header name doesn't exist and relies on57//    the header map to remap it to the real header.58#include "Before/Mapping.h"59