Debian Codegraph @

clang/test/Modules/shadow.m

raw
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 -I %S/Inputs/shadow %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/Inputs/shadow %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 -x objective-c-header %S/Inputs/shadow/A1/module.modulemap -emit-module -o %t/A.pcm -fmodule-name=A
8 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodule-map-file=%S/Inputs/shadow/A1/module.modulemap -fmodule-file=A=%t/A.pcm -I %S/Inputs/shadow %s -verify
9
10 #import "A1/A1.h"
11 #import "A2/A2.h"
12 @import A;
13
14 #import "A2/A.h" // expected-note {{implicitly imported}}
15 // expected-error@A2/module.modulemap:1 {{import of shadowed module 'A'}}
16 // expected-note@A1/module.modulemap:1 {{previous definition}}
17
18 #if defined(A2_A_h)
19 #error got the wrong definition of module A
20 #elif !defined(A1_A_h)
21 #error missing definition from A1
22 #endif