1 | // RUN: rm -rf %t |
2 | // RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/shadow/A1 -I %S/Inputs/shadow/A2 %s -fsyntax-only 2>&1 | FileCheck %s -check-prefix=REDEFINITION |
3 | // RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodule-map-file=%S/Inputs/shadow/A1/module.modulemap -fmodule-map-file=%S/Inputs/shadow/A2/module.modulemap %s -fsyntax-only 2>&1 | FileCheck %s -check-prefix=REDEFINITION |
4 | // REDEFINITION: error: redefinition of module 'A' |
5 | // REDEFINITION: note: previously defined |
6 | |
7 | // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodule-map-file=%S/Inputs/shadow/A1/module.modulemap -I %S/Inputs/shadow %s -verify |
8 | |
9 | @import A1; |
10 | @import A2; |
11 | @import A; |
12 | |
13 | #import "A2/A.h" // expected-note {{implicitly imported}} |
14 | // expected-error@A2/module.modulemap:1 {{import of shadowed module 'A'}} |
15 | // expected-note@A1/module.modulemap:1 {{previous definition}} |
16 | |
17 | #if defined(A2_A_h) |
18 | #error got the wrong definition of module A |
19 | #elif !defined(A1_A_h) |
20 | #error missing definition from A1 |
21 | #endif |
22 | |