diff options
Diffstat (limited to 'clang/test/Modules')
-rw-r--r-- | clang/test/Modules/Inputs/private/common.h | 6 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private/module.map | 9 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private/private1.h | 9 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private/private2.h | 9 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private/public1.h | 9 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private/public2.h | 9 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private0/common.h | 6 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private1/module.map | 4 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private1/private1.h | 9 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private1/public1.h | 9 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private2/module.map | 4 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private2/private2.h | 9 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/private2/public2.h | 9 | ||||
-rw-r--r-- | clang/test/Modules/private.cpp | 13 | ||||
-rw-r--r-- | clang/test/Modules/private1.cpp | 13 |
15 files changed, 127 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/private/common.h b/clang/test/Modules/Inputs/private/common.h new file mode 100644 index 00000000000..17d5444b650 --- /dev/null +++ b/clang/test/Modules/Inputs/private/common.h @@ -0,0 +1,6 @@ +#ifndef COMMON_H +#define COMMON_H + +typedef int common; + +#endif diff --git a/clang/test/Modules/Inputs/private/module.map b/clang/test/Modules/Inputs/private/module.map new file mode 100644 index 00000000000..9da44354be1 --- /dev/null +++ b/clang/test/Modules/Inputs/private/module.map @@ -0,0 +1,9 @@ +module libPrivate1 { + header "public1.h" + private header "private1.h" +} + +module libPrivate2 { + header "public2.h" + private header "private2.h" +} diff --git a/clang/test/Modules/Inputs/private/private1.h b/clang/test/Modules/Inputs/private/private1.h new file mode 100644 index 00000000000..3f41cc0181d --- /dev/null +++ b/clang/test/Modules/Inputs/private/private1.h @@ -0,0 +1,9 @@ +#ifndef PRIVATE1_H +#define PRIVATE1_H + +#include "common.h" + +struct mitts_off1 { common field; }; +struct mitts_off1 hidden_variable1; + +#endif diff --git a/clang/test/Modules/Inputs/private/private2.h b/clang/test/Modules/Inputs/private/private2.h new file mode 100644 index 00000000000..3b6cddc4d90 --- /dev/null +++ b/clang/test/Modules/Inputs/private/private2.h @@ -0,0 +1,9 @@ +#ifndef PRIVATE2_H +#define PRIVATE2_H + +#include "common.h" + +struct mitts_off2 { common field; }; +struct mitts_off2 hidden_variable2; + +#endif diff --git a/clang/test/Modules/Inputs/private/public1.h b/clang/test/Modules/Inputs/private/public1.h new file mode 100644 index 00000000000..3af596a98d0 --- /dev/null +++ b/clang/test/Modules/Inputs/private/public1.h @@ -0,0 +1,9 @@ +#ifndef PUBLIC1_H +#define PUBLIC1_H + +#include "private1.h" + +struct use_this1 { struct mitts_off1 field; }; +struct use_this1 public_variable1; + +#endif diff --git a/clang/test/Modules/Inputs/private/public2.h b/clang/test/Modules/Inputs/private/public2.h new file mode 100644 index 00000000000..03d0a858e10 --- /dev/null +++ b/clang/test/Modules/Inputs/private/public2.h @@ -0,0 +1,9 @@ +#ifndef PUBLIC2_H +#define PUBLIC2_H + +#include "private2.h" + +struct use_this2 { struct mitts_off2 field; }; +struct use_this2 public_variable2; + +#endif diff --git a/clang/test/Modules/Inputs/private0/common.h b/clang/test/Modules/Inputs/private0/common.h new file mode 100644 index 00000000000..17d5444b650 --- /dev/null +++ b/clang/test/Modules/Inputs/private0/common.h @@ -0,0 +1,6 @@ +#ifndef COMMON_H +#define COMMON_H + +typedef int common; + +#endif diff --git a/clang/test/Modules/Inputs/private1/module.map b/clang/test/Modules/Inputs/private1/module.map new file mode 100644 index 00000000000..445c8010db9 --- /dev/null +++ b/clang/test/Modules/Inputs/private1/module.map @@ -0,0 +1,4 @@ +module libPrivate1 { + header "public1.h" + private header "private1.h" +} diff --git a/clang/test/Modules/Inputs/private1/private1.h b/clang/test/Modules/Inputs/private1/private1.h new file mode 100644 index 00000000000..3f41cc0181d --- /dev/null +++ b/clang/test/Modules/Inputs/private1/private1.h @@ -0,0 +1,9 @@ +#ifndef PRIVATE1_H +#define PRIVATE1_H + +#include "common.h" + +struct mitts_off1 { common field; }; +struct mitts_off1 hidden_variable1; + +#endif diff --git a/clang/test/Modules/Inputs/private1/public1.h b/clang/test/Modules/Inputs/private1/public1.h new file mode 100644 index 00000000000..3af596a98d0 --- /dev/null +++ b/clang/test/Modules/Inputs/private1/public1.h @@ -0,0 +1,9 @@ +#ifndef PUBLIC1_H +#define PUBLIC1_H + +#include "private1.h" + +struct use_this1 { struct mitts_off1 field; }; +struct use_this1 public_variable1; + +#endif diff --git a/clang/test/Modules/Inputs/private2/module.map b/clang/test/Modules/Inputs/private2/module.map new file mode 100644 index 00000000000..6c5efb60209 --- /dev/null +++ b/clang/test/Modules/Inputs/private2/module.map @@ -0,0 +1,4 @@ +module libPrivate2 { + header "public2.h" + private header "private2.h" +} diff --git a/clang/test/Modules/Inputs/private2/private2.h b/clang/test/Modules/Inputs/private2/private2.h new file mode 100644 index 00000000000..3b6cddc4d90 --- /dev/null +++ b/clang/test/Modules/Inputs/private2/private2.h @@ -0,0 +1,9 @@ +#ifndef PRIVATE2_H +#define PRIVATE2_H + +#include "common.h" + +struct mitts_off2 { common field; }; +struct mitts_off2 hidden_variable2; + +#endif diff --git a/clang/test/Modules/Inputs/private2/public2.h b/clang/test/Modules/Inputs/private2/public2.h new file mode 100644 index 00000000000..03d0a858e10 --- /dev/null +++ b/clang/test/Modules/Inputs/private2/public2.h @@ -0,0 +1,9 @@ +#ifndef PUBLIC2_H +#define PUBLIC2_H + +#include "private2.h" + +struct use_this2 { struct mitts_off2 field; }; +struct use_this2 public_variable2; + +#endif diff --git a/clang/test/Modules/private.cpp b/clang/test/Modules/private.cpp new file mode 100644 index 00000000000..93b4b9457f4 --- /dev/null +++ b/clang/test/Modules/private.cpp @@ -0,0 +1,13 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/private %s -verify + +#include "common.h" +@import libPrivate1; +#include "private1.h" // expected-error {{use of private header from outside its module}} +#include "public2.h" +#include "private2.h" // expected-error {{use of private header from outside its module}} + +struct use_this1 client_variable1; +struct use_this2 client_variable2; +struct mitts_off1 client_variable3; +struct mitts_off2 client_variable4; diff --git a/clang/test/Modules/private1.cpp b/clang/test/Modules/private1.cpp new file mode 100644 index 00000000000..e4eec0a515c --- /dev/null +++ b/clang/test/Modules/private1.cpp @@ -0,0 +1,13 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/private0 -I %S/Inputs/private1 -I %S/Inputs/private2 %s -verify + +#include "common.h" +@import libPrivate1; +#include "private1.h" // expected-error {{use of private header from outside its module}} +#include "public2.h" +#include "private2.h" // expected-error {{use of private header from outside its module}} + +struct use_this1 client_variable1; +struct use_this2 client_variable2; +struct mitts_off1 client_variable3; +struct mitts_off2 client_variable4; |