| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
|
| 4 |
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache \ |
| 5 |
// RUN: -emit-module %t/module.modulemap -fmodule-name=B -o %t/cache/B.pcm \ |
| 6 |
// RUN: -fmodules-single-module-parse-mode 2>&1 | FileCheck %s |
| 7 |
|
| 8 |
// Modules are not imported. |
| 9 |
// CHECK-NOT: A.h:1:2: error: unreachable |
| 10 |
|
| 11 |
// Headers belonging to this module are included. |
| 12 |
// CHECK: B2.h:2:2: warning: success |
| 13 |
|
| 14 |
// Non-modular headers are included. |
| 15 |
// CHECK: T.h:2:2: warning: success |
| 16 |
|
| 17 |
// No branches are entered for #if UNDEFINED. |
| 18 |
// CHECK-NOT: B1.h:6:2: error: unreachable |
| 19 |
// CHECK-NOT: B1.h:8:2: error: unreachable |
| 20 |
// CHECK-NOT: B1.h:10:2: error: unreachable |
| 21 |
|
| 22 |
// No branches are entered for #ifdef UNDEFINED. |
| 23 |
// CHECK-NOT: B1.h:14:2: error: unreachable |
| 24 |
// CHECK-NOT: B1.h:16:2: error: unreachable |
| 25 |
|
| 26 |
// No branches are entered for #ifndef UNDEFINED. |
| 27 |
// CHECK-NOT: B1.h:20:2: error: unreachable |
| 28 |
// CHECK-NOT: B1.h:22:2: error: unreachable |
| 29 |
|
| 30 |
// No error messages are emitted for UNDEFINED_FUNCTION_LIKE(). |
| 31 |
// CHECK-NOT: B1.h:25:2: error: unreachable |
| 32 |
|
| 33 |
// The correct branch is entered for #if DEFINED. |
| 34 |
// CHECK: B1.h:32:3: warning: success |
| 35 |
// CHECK-NOT: B1.h:34:3: error: unreachable |
| 36 |
// CHECK-NOT: B1.h:36:3: error: unreachable |
| 37 |
|
| 38 |
// Headers belonging to this module are included. |
| 39 |
// CHECK: B2.h:2:2: warning: success |
| 40 |
|
| 41 |
//--- module.modulemap |
| 42 |
module A { header "A.h" } |
| 43 |
module B { |
| 44 |
header "B1.h" |
| 45 |
header "B2.h" |
| 46 |
} |
| 47 |
//--- A.h |
| 48 |
#error unreachable |
| 49 |
//--- B1.h |
| 50 |
#include "A.h" |
| 51 |
#include "B2.h" |
| 52 |
#include "T.h" |
| 53 |
|
| 54 |
#if UNDEFINED |
| 55 |
# error unreachable |
| 56 |
#elif UNDEFINED2 |
| 57 |
# error unreachable |
| 58 |
#else |
| 59 |
# error unreachable |
| 60 |
#endif |
| 61 |
|
| 62 |
#ifdef UNDEFINED |
| 63 |
# error unreachable |
| 64 |
#else |
| 65 |
# error unreachable |
| 66 |
#endif |
| 67 |
|
| 68 |
#ifndef UNDEFINED |
| 69 |
# error unreachable |
| 70 |
#else |
| 71 |
# error unreachable |
| 72 |
#endif |
| 73 |
|
| 74 |
#if UNDEFINED_FUNCTION_LIKE() |
| 75 |
#endif |
| 76 |
|
| 77 |
#define DEFINED_1 1 |
| 78 |
#define DEFINED_2 1 |
| 79 |
|
| 80 |
#if DEFINED_1 |
| 81 |
# warning success |
| 82 |
#elif DEFINED_2 |
| 83 |
# error unreachable |
| 84 |
#else |
| 85 |
# error unreachable |
| 86 |
#endif |
| 87 |
//--- B2.h |
| 88 |
// Headers belonging to this module are included. |
| 89 |
#warning success |
| 90 |
//--- T.h |
| 91 |
// Non-modular headers are included. |
| 92 |
#warning success |