]> granicus.if.org Git - clang/commitdiff
Test files for private header patch.
authorLawrence Crowl <crowl@google.com>
Thu, 20 Jun 2013 21:15:51 +0000 (21:15 +0000)
committerLawrence Crowl <crowl@google.com>
Thu, 20 Jun 2013 21:15:51 +0000 (21:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184472 91177308-0d34-0410-b5e6-96231b3b80d8

15 files changed:
test/Modules/Inputs/private/common.h [new file with mode: 0644]
test/Modules/Inputs/private/module.map [new file with mode: 0644]
test/Modules/Inputs/private/private1.h [new file with mode: 0644]
test/Modules/Inputs/private/private2.h [new file with mode: 0644]
test/Modules/Inputs/private/public1.h [new file with mode: 0644]
test/Modules/Inputs/private/public2.h [new file with mode: 0644]
test/Modules/Inputs/private0/common.h [new file with mode: 0644]
test/Modules/Inputs/private1/module.map [new file with mode: 0644]
test/Modules/Inputs/private1/private1.h [new file with mode: 0644]
test/Modules/Inputs/private1/public1.h [new file with mode: 0644]
test/Modules/Inputs/private2/module.map [new file with mode: 0644]
test/Modules/Inputs/private2/private2.h [new file with mode: 0644]
test/Modules/Inputs/private2/public2.h [new file with mode: 0644]
test/Modules/private.cpp [new file with mode: 0644]
test/Modules/private1.cpp [new file with mode: 0644]

diff --git a/test/Modules/Inputs/private/common.h b/test/Modules/Inputs/private/common.h
new file mode 100644 (file)
index 0000000..17d5444
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef COMMON_H
+#define COMMON_H
+
+typedef int common;
+
+#endif
diff --git a/test/Modules/Inputs/private/module.map b/test/Modules/Inputs/private/module.map
new file mode 100644 (file)
index 0000000..9da4435
--- /dev/null
@@ -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/test/Modules/Inputs/private/private1.h b/test/Modules/Inputs/private/private1.h
new file mode 100644 (file)
index 0000000..3f41cc0
--- /dev/null
@@ -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/test/Modules/Inputs/private/private2.h b/test/Modules/Inputs/private/private2.h
new file mode 100644 (file)
index 0000000..3b6cddc
--- /dev/null
@@ -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/test/Modules/Inputs/private/public1.h b/test/Modules/Inputs/private/public1.h
new file mode 100644 (file)
index 0000000..3af596a
--- /dev/null
@@ -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/test/Modules/Inputs/private/public2.h b/test/Modules/Inputs/private/public2.h
new file mode 100644 (file)
index 0000000..03d0a85
--- /dev/null
@@ -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/test/Modules/Inputs/private0/common.h b/test/Modules/Inputs/private0/common.h
new file mode 100644 (file)
index 0000000..17d5444
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef COMMON_H
+#define COMMON_H
+
+typedef int common;
+
+#endif
diff --git a/test/Modules/Inputs/private1/module.map b/test/Modules/Inputs/private1/module.map
new file mode 100644 (file)
index 0000000..445c801
--- /dev/null
@@ -0,0 +1,4 @@
+module libPrivate1 {
+  header "public1.h"
+  private header "private1.h"
+}
diff --git a/test/Modules/Inputs/private1/private1.h b/test/Modules/Inputs/private1/private1.h
new file mode 100644 (file)
index 0000000..3f41cc0
--- /dev/null
@@ -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/test/Modules/Inputs/private1/public1.h b/test/Modules/Inputs/private1/public1.h
new file mode 100644 (file)
index 0000000..3af596a
--- /dev/null
@@ -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/test/Modules/Inputs/private2/module.map b/test/Modules/Inputs/private2/module.map
new file mode 100644 (file)
index 0000000..6c5efb6
--- /dev/null
@@ -0,0 +1,4 @@
+module libPrivate2 {
+  header "public2.h"
+  private header "private2.h"
+}
diff --git a/test/Modules/Inputs/private2/private2.h b/test/Modules/Inputs/private2/private2.h
new file mode 100644 (file)
index 0000000..3b6cddc
--- /dev/null
@@ -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/test/Modules/Inputs/private2/public2.h b/test/Modules/Inputs/private2/public2.h
new file mode 100644 (file)
index 0000000..03d0a85
--- /dev/null
@@ -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/test/Modules/private.cpp b/test/Modules/private.cpp
new file mode 100644 (file)
index 0000000..93b4b94
--- /dev/null
@@ -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/test/Modules/private1.cpp b/test/Modules/private1.cpp
new file mode 100644 (file)
index 0000000..e4eec0a
--- /dev/null
@@ -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;