| 1 | // RUN: %clang_cc1 -fmodules-ts %s -verify -o /dev/null |
| 2 | // RUN: %clang_cc1 -fmodules-ts %s -DINTERFACE -verify -emit-module-interface -o %t |
| 3 | // RUN: %clang_cc1 -fmodules-ts %s -DIMPLEMENTATION -verify -fmodule-file=%t -o /dev/null |
| 4 | // |
| 5 | // RUN: %clang_cc1 -fmodules-ts %s -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null |
| 6 | // RUN: %clang_cc1 -fmodules-ts %s -DINTERFACE -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null |
| 7 | // RUN: %clang_cc1 -fmodules-ts %s -DIMPLEMENTATION -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null |
| 8 | |
| 9 | #if INTERFACE |
| 10 | // expected-no-diagnostics |
| 11 | export module A; |
| 12 | #elif IMPLEMENTATION |
| 13 | module A; |
| 14 | #ifdef BUILT_AS_INTERFACE |
| 15 | // expected-error@-2 {{missing 'export' specifier in module declaration while building module interface}} |
| 16 | #define INTERFACE |
| 17 | #endif |
| 18 | #else |
| 19 | #ifdef BUILT_AS_INTERFACE |
| 20 | // expected-error@1 {{missing 'export module' declaration in module interface unit}} |
| 21 | #endif |
| 22 | #endif |
| 23 | |
| 24 | #ifndef INTERFACE |
| 25 | export int b; // expected-error {{export declaration can only be used within a module interface unit}} |
| 26 | #else |
| 27 | export int a; |
| 28 | #endif |
| 29 | |