1 // RUN: %clang_cc1 -fmodules-ts -fmodule-name=ab -x c++-header %S/Inputs/no-module-map/a.h %S/Inputs/no-module-map/b.h -emit-header-module -o %t.pcm
2 // RUN: %clang_cc1 -fmodules-ts -fmodule-file=%t.pcm %s -I%S/Inputs/no-module-map -verify
3 // RUN: %clang_cc1 -fmodules-ts -fmodule-file=%t.pcm %s -I%S/Inputs/no-module-map -verify -DA
4 // RUN: %clang_cc1 -fmodules-ts -fmodule-file=%t.pcm %s -I%S/Inputs/no-module-map -verify -DB
5 // RUN: %clang_cc1 -fmodules-ts -fmodule-file=%t.pcm %s -I%S/Inputs/no-module-map -verify -DA -DB
6 
7 // RUN: %clang_cc1 -E %t.pcm -o - | FileCheck %s
8 // RUN: %clang_cc1 -frewrite-imports -E %t.pcm -o - | FileCheck %s
9 // CHECK: # {{.*}}a.h
10 // CHECK: # {{.*}}b.h
11 
12 #ifdef B
13 // expected-no-diagnostics
14 #endif
15 
16 #ifdef A
17 #include "a.h"
18 #endif
19 
20 #ifdef B
21 #include "b.h"
22 #endif
23 
24 #if defined(A) || defined(B)
25 #ifndef A_H
26 #error A_H should be defined
27 #endif
28 #else
29 #ifdef A_H
30 #error A_H should not be defined
31 #endif
32 // expected-error@+3 {{must be imported from}}
33 // expected-note@* {{declaration}}
34 #endif
use_a()35 void use_a() { a(); }
36 
37 #if defined(B)
38 #ifndef B_H
39 #error B_H should be defined
40 #endif
41 #else
42 #ifdef B_H
43 #error B_H should not be defined
44 #endif
45 // expected-error@+3 {{must be imported from}}
46 // expected-note@* {{declaration}}
47 #endif
use_b()48 void use_b() { b(); }
49