Richard Smith | d6509cf | 2018-09-15 01:21:15 +0000 | [diff] [blame] | 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 | #ifdef B |
| 8 | // expected-no-diagnostics |
| 9 | #endif |
| 10 | |
| 11 | #ifdef A |
| 12 | #include "a.h" |
| 13 | #endif |
| 14 | |
| 15 | #ifdef B |
| 16 | #include "b.h" |
| 17 | #endif |
| 18 | |
| 19 | #if defined(A) || defined(B) |
| 20 | #ifndef A_H |
| 21 | #error A_H should be defined |
| 22 | #endif |
| 23 | #else |
| 24 | #ifdef A_H |
| 25 | #error A_H should not be defined |
| 26 | #endif |
| 27 | // expected-error@+3 {{must be imported from}} |
| 28 | // expected-note@* {{previous declaration}} |
| 29 | #endif |
| 30 | void use_a() { a(); } |
| 31 | |
| 32 | #if defined(B) |
| 33 | #ifndef B_H |
| 34 | #error B_H should be defined |
| 35 | #endif |
| 36 | #else |
| 37 | #ifdef B_H |
| 38 | #error B_H should not be defined |
| 39 | #endif |
| 40 | // expected-error@+3 {{must be imported from}} |
| 41 | // expected-note@* {{previous declaration}} |
| 42 | #endif |
| 43 | void use_b() { b(); } |