summaryrefslogtreecommitdiff
path: root/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'test/Modules')
-rw-r--r--test/Modules/Inputs/Modified/A.h1
-rw-r--r--test/Modules/Inputs/Modified/B.h2
-rw-r--r--test/Modules/Inputs/Modified/module.map2
-rw-r--r--test/Modules/Inputs/Module.framework/Headers/Module.h2
-rw-r--r--test/Modules/Inputs/NoUmbrella.framework/module.map5
-rw-r--r--test/Modules/Inputs/NotAModule.framework/Headers/NotAModule.h2
-rw-r--r--test/Modules/Inputs/lookup_right.hpp1
-rw-r--r--test/Modules/Inputs/macros.h9
-rw-r--r--test/Modules/Inputs/macros_left.h14
-rw-r--r--test/Modules/Inputs/macros_other.h1
-rw-r--r--test/Modules/Inputs/macros_right.h17
-rw-r--r--test/Modules/Inputs/macros_right_undef.h1
-rw-r--r--test/Modules/Inputs/macros_top.h16
-rw-r--r--test/Modules/Inputs/module.map30
-rw-r--r--test/Modules/Inputs/normal-module-map/nested_umbrella/1.h1
-rw-r--r--test/Modules/Inputs/normal-module-map/nested_umbrella/a-extras.h1
-rw-r--r--test/Modules/Inputs/normal-module-map/nested_umbrella/decltype.h2
-rw-r--r--test/Modules/Inputs/redecl-merge-bottom.h8
-rw-r--r--test/Modules/Inputs/redecl-merge-left.h8
-rw-r--r--test/Modules/Inputs/redecl-merge-right.h9
-rw-r--r--test/Modules/Inputs/redecl-merge-top.h4
-rw-r--r--test/Modules/Inputs/templates-left.h29
-rw-r--r--test/Modules/Inputs/templates-right.h27
-rw-r--r--test/Modules/Inputs/templates-top.h17
-rw-r--r--test/Modules/compiler_builtins.m2
-rw-r--r--test/Modules/direct-module-import.m7
-rw-r--r--test/Modules/header-import.m1
-rw-r--r--test/Modules/import-decl.cpp2
-rw-r--r--test/Modules/inferred-frameworks.m8
-rw-r--r--test/Modules/inferred-submodules.m1
-rw-r--r--test/Modules/macros.c107
-rw-r--r--test/Modules/modify-module.m23
-rw-r--r--test/Modules/module-private.cpp7
-rw-r--r--test/Modules/normal-module-map.cpp10
-rw-r--r--test/Modules/on-demand-macros.m1
-rw-r--r--test/Modules/redecl-merge.m20
-rw-r--r--test/Modules/redeclarations.m1
-rw-r--r--test/Modules/submodules.m1
-rw-r--r--test/Modules/templates.mm36
39 files changed, 389 insertions, 47 deletions
diff --git a/test/Modules/Inputs/Modified/A.h b/test/Modules/Inputs/Modified/A.h
new file mode 100644
index 0000000000000..ff833c7520f03
--- /dev/null
+++ b/test/Modules/Inputs/Modified/A.h
@@ -0,0 +1 @@
+int getA();
diff --git a/test/Modules/Inputs/Modified/B.h b/test/Modules/Inputs/Modified/B.h
new file mode 100644
index 0000000000000..d1c8bb5e8e156
--- /dev/null
+++ b/test/Modules/Inputs/Modified/B.h
@@ -0,0 +1,2 @@
+#include "A.h"
+int getB();
diff --git a/test/Modules/Inputs/Modified/module.map b/test/Modules/Inputs/Modified/module.map
new file mode 100644
index 0000000000000..d9aed01430c41
--- /dev/null
+++ b/test/Modules/Inputs/Modified/module.map
@@ -0,0 +1,2 @@
+module A { header "A.h" }
+module B { header "B.h" }
diff --git a/test/Modules/Inputs/Module.framework/Headers/Module.h b/test/Modules/Inputs/Module.framework/Headers/Module.h
index f8949848bd4c9..3d2476b20431d 100644
--- a/test/Modules/Inputs/Module.framework/Headers/Module.h
+++ b/test/Modules/Inputs/Module.framework/Headers/Module.h
@@ -23,4 +23,6 @@ const char *getModuleVersion(void);
#include <Module/Sub.h>
#include <Module/Buried/Treasure.h>
+__asm("foo");
+
#endif // MODULE_H
diff --git a/test/Modules/Inputs/NoUmbrella.framework/module.map b/test/Modules/Inputs/NoUmbrella.framework/module.map
index 4a4d9702c5ff9..03a8a17e68c0a 100644
--- a/test/Modules/Inputs/NoUmbrella.framework/module.map
+++ b/test/Modules/Inputs/NoUmbrella.framework/module.map
@@ -2,8 +2,5 @@ framework module NoUmbrella [system] {
umbrella "Headers"
module * { }
- module unavailable {
- requires unavailable
- header "Boom.h"
- }
+ exclude header "Boom.h"
}
diff --git a/test/Modules/Inputs/NotAModule.framework/Headers/NotAModule.h b/test/Modules/Inputs/NotAModule.framework/Headers/NotAModule.h
new file mode 100644
index 0000000000000..263979212bbdf
--- /dev/null
+++ b/test/Modules/Inputs/NotAModule.framework/Headers/NotAModule.h
@@ -0,0 +1,2 @@
+extern int not_a_module;
+
diff --git a/test/Modules/Inputs/lookup_right.hpp b/test/Modules/Inputs/lookup_right.hpp
index 884534747f69b..b2611a1380cc5 100644
--- a/test/Modules/Inputs/lookup_right.hpp
+++ b/test/Modules/Inputs/lookup_right.hpp
@@ -1 +1,2 @@
float *f0(float*);
+// expected-no-diagnostics
diff --git a/test/Modules/Inputs/macros.h b/test/Modules/Inputs/macros.h
index 4f535563ad27d..27f43c0626ec3 100644
--- a/test/Modules/Inputs/macros.h
+++ b/test/Modules/Inputs/macros.h
@@ -8,3 +8,12 @@
#__private_macro MODULE
int (INTEGER);
+
+#if !__building_module(macros)
+# error Can't include this header without building the 'macros' module.
+#endif
+
+#ifdef __MODULE__
+extern int __MODULE__;
+#endif
+
diff --git a/test/Modules/Inputs/macros_left.h b/test/Modules/Inputs/macros_left.h
new file mode 100644
index 0000000000000..cd0569389189d
--- /dev/null
+++ b/test/Modules/Inputs/macros_left.h
@@ -0,0 +1,14 @@
+@__experimental_modules_import macros_top;
+#define LEFT unsigned long
+
+#undef TOP_LEFT_UNDEF
+
+
+
+
+#define LEFT_RIGHT_IDENTICAL int
+
+#define LEFT_RIGHT_DIFFERENT2 float
+#define LEFT_RIGHT_DIFFERENT3 float
+
+#define LEFT_RIGHT_DIFFERENT float
diff --git a/test/Modules/Inputs/macros_other.h b/test/Modules/Inputs/macros_other.h
new file mode 100644
index 0000000000000..ea686bfc558aa
--- /dev/null
+++ b/test/Modules/Inputs/macros_other.h
@@ -0,0 +1 @@
+#define OTHER_INTEGER int
diff --git a/test/Modules/Inputs/macros_right.h b/test/Modules/Inputs/macros_right.h
new file mode 100644
index 0000000000000..e16a64b50ad31
--- /dev/null
+++ b/test/Modules/Inputs/macros_right.h
@@ -0,0 +1,17 @@
+@__experimental_modules_import macros_top;
+#define RIGHT unsigned short
+
+
+
+
+
+
+
+
+#define LEFT_RIGHT_IDENTICAL int
+#define LEFT_RIGHT_DIFFERENT int
+#define LEFT_RIGHT_DIFFERENT2 int
+#define LEFT_RIGHT_DIFFERENT3 int
+
+#undef TOP_RIGHT_REDEF
+#define TOP_RIGHT_REDEF float
diff --git a/test/Modules/Inputs/macros_right_undef.h b/test/Modules/Inputs/macros_right_undef.h
new file mode 100644
index 0000000000000..49473e36f0cbb
--- /dev/null
+++ b/test/Modules/Inputs/macros_right_undef.h
@@ -0,0 +1 @@
+#undef TOP_RIGHT_UNDEF
diff --git a/test/Modules/Inputs/macros_top.h b/test/Modules/Inputs/macros_top.h
new file mode 100644
index 0000000000000..9c3f3c071fd02
--- /dev/null
+++ b/test/Modules/Inputs/macros_top.h
@@ -0,0 +1,16 @@
+#define TOP unsigned int
+
+#define TOP_LEFT_UNDEF 1
+
+
+
+
+
+
+
+
+
+#define TOP_RIGHT_REDEF int
+
+#define TOP_RIGHT_UNDEF int
+
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index 79056cb51800f..032241d6aa1e3 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -18,6 +18,20 @@ module lookup_left_cxx { header "lookup_left.hpp" }
module lookup_right_cxx { header "lookup_right.hpp" }
module module_private_left { header "module_private_left.h" }
module module_private_right { header "module_private_right.h" }
+module macros_top {
+ header "macros_top.h"
+}
+module macros_left {
+ header "macros_left.h"
+ export *
+}
+module macros_right {
+ header "macros_right.h"
+ export *
+ explicit module undef {
+ header "macros_right_undef.h"
+ }
+}
module macros { header "macros.h" }
module category_top { header "category_top.h" }
module category_left {
@@ -78,6 +92,18 @@ module namespaces_right {
header "namespaces-right.h"
export *
}
+module templates_top {
+ header "templates-top.h"
+ export *
+}
+module templates_left {
+ header "templates-left.h"
+ export *
+}
+module templates_right {
+ header "templates-right.h"
+ export *
+}
module MethodPoolA {
header "MethodPoolA.h"
}
@@ -87,3 +113,7 @@ module MethodPoolB {
module import_decl {
header "import-decl.h"
}
+
+framework module * {
+ exclude NotAModule
+}
diff --git a/test/Modules/Inputs/normal-module-map/nested_umbrella/1.h b/test/Modules/Inputs/normal-module-map/nested_umbrella/1.h
new file mode 100644
index 0000000000000..e8a3e6340d512
--- /dev/null
+++ b/test/Modules/Inputs/normal-module-map/nested_umbrella/1.h
@@ -0,0 +1 @@
+int one;
diff --git a/test/Modules/Inputs/normal-module-map/nested_umbrella/a-extras.h b/test/Modules/Inputs/normal-module-map/nested_umbrella/a-extras.h
new file mode 100644
index 0000000000000..91522aa1a9623
--- /dev/null
+++ b/test/Modules/Inputs/normal-module-map/nested_umbrella/a-extras.h
@@ -0,0 +1 @@
+int extra_a;
diff --git a/test/Modules/Inputs/normal-module-map/nested_umbrella/decltype.h b/test/Modules/Inputs/normal-module-map/nested_umbrella/decltype.h
new file mode 100644
index 0000000000000..506a217d1b98a
--- /dev/null
+++ b/test/Modules/Inputs/normal-module-map/nested_umbrella/decltype.h
@@ -0,0 +1,2 @@
+int decltype_val;
+
diff --git a/test/Modules/Inputs/redecl-merge-bottom.h b/test/Modules/Inputs/redecl-merge-bottom.h
index 40a9404abf292..cfea7dc87da58 100644
--- a/test/Modules/Inputs/redecl-merge-bottom.h
+++ b/test/Modules/Inputs/redecl-merge-bottom.h
@@ -18,11 +18,3 @@ struct S3;
void refers_to_C4(C4*);
-#ifdef __cplusplus
-template<typename T> class Vector;
-
-template<typename T> class Vector;
-
-template<typename T> class Vector;
-#endif
-
diff --git a/test/Modules/Inputs/redecl-merge-left.h b/test/Modules/Inputs/redecl-merge-left.h
index b3a7ba83c1af2..5e6d2e512b009 100644
--- a/test/Modules/Inputs/redecl-merge-left.h
+++ b/test/Modules/Inputs/redecl-merge-left.h
@@ -60,7 +60,7 @@ typedef int T1;
typedef float T2;
int func0(int);
-int func1(int);
+int func1(int x) { return x; }
int func2(int);
@@ -78,12 +78,6 @@ extern float var2;
extern double var3;
-#ifdef __cplusplus
-template<typename T> class Vector;
-
-template<typename T> class Vector;
-#endif
-
// Make sure this doesn't introduce an ambiguity-creating 'id' at the
// top level.
typedef void funcptr_with_id(int id);
diff --git a/test/Modules/Inputs/redecl-merge-right.h b/test/Modules/Inputs/redecl-merge-right.h
index de7aa08cfb2b4..20223083c31aa 100644
--- a/test/Modules/Inputs/redecl-merge-right.h
+++ b/test/Modules/Inputs/redecl-merge-right.h
@@ -65,7 +65,7 @@ typedef double T2;
int func0(int);
int func1(int);
int func1(int);
-int func1(int);
+int func1(int x) { return x; }
int func1(int);
static int func2(int);
@@ -78,13 +78,6 @@ extern int var2;
static double var3;
-#ifdef __cplusplus
-template<typename T> class Vector {
-public:
- void push_back(const T&);
-};
-#endif
-
int ONE;
@__experimental_modules_import redecl_merge_top.Explicit;
const int one = ONE;
diff --git a/test/Modules/Inputs/redecl-merge-top.h b/test/Modules/Inputs/redecl-merge-top.h
index 519254ca22139..690e6df1c9e2c 100644
--- a/test/Modules/Inputs/redecl-merge-top.h
+++ b/test/Modules/Inputs/redecl-merge-top.h
@@ -15,6 +15,4 @@ struct S1;
struct S2;
struct S2;
-#ifdef __cplusplus
-template<typename T> class Vector;
-#endif
+int func1(int);
diff --git a/test/Modules/Inputs/templates-left.h b/test/Modules/Inputs/templates-left.h
new file mode 100644
index 0000000000000..57a8c85bf602b
--- /dev/null
+++ b/test/Modules/Inputs/templates-left.h
@@ -0,0 +1,29 @@
+@__experimental_modules_import templates_top;
+
+template<typename T> class Vector;
+
+template<typename T> class Vector;
+
+template<typename T> class List;
+template<> class List<bool> {
+public:
+ void push_back(int);
+};
+namespace N {
+ template<typename T> class Set;
+}
+namespace N {
+ template<typename T> class Set {
+ public:
+ void insert(T);
+ };
+}
+
+template <typename T>
+void pendingInstantiationEmit(T) {}
+void triggerPendingInstantiation() {
+ pendingInstantiationEmit(12);
+ pendingInstantiationEmit(42.);
+}
+
+void redeclDefinitionEmit(){}
diff --git a/test/Modules/Inputs/templates-right.h b/test/Modules/Inputs/templates-right.h
new file mode 100644
index 0000000000000..4ef4a32e8e276
--- /dev/null
+++ b/test/Modules/Inputs/templates-right.h
@@ -0,0 +1,27 @@
+@__experimental_modules_import templates_top;
+
+template<typename T> class Vector {
+public:
+ void push_back(const T&);
+};
+
+template<typename T> class List;
+template<> class List<bool> {
+public:
+ void push_back(int);
+};
+
+namespace N {
+ template<typename T> class Set {
+ public:
+ void insert(T);
+ };
+}
+
+template <typename T>
+void pendingInstantiationEmit(T) {}
+void triggerPendingInstantiationToo() {
+ pendingInstantiationEmit(12);
+}
+
+void redeclDefinitionEmit(){}
diff --git a/test/Modules/Inputs/templates-top.h b/test/Modules/Inputs/templates-top.h
new file mode 100644
index 0000000000000..5985ee8820d69
--- /dev/null
+++ b/test/Modules/Inputs/templates-top.h
@@ -0,0 +1,17 @@
+template<typename T> class Vector;
+
+template<typename T> class List {
+public:
+ void push_back(T);
+};
+
+namespace A {
+ class Y {
+ template <typename T> friend class WhereAmI;
+ };
+}
+
+template <typename T> class A::WhereAmI {
+public:
+ static void func() {}
+};
diff --git a/test/Modules/compiler_builtins.m b/test/Modules/compiler_builtins.m
index de6f57b5f285b..dfa46c8a34f5c 100644
--- a/test/Modules/compiler_builtins.m
+++ b/test/Modules/compiler_builtins.m
@@ -1,5 +1,7 @@
// RUN: rm -rf %t
// RUN: %clang -fsyntax-only -fmodules -fmodule-cache-path %t -D__need_wint_t %s -Xclang -verify
+// RUN: %clang -fsyntax-only -std=c99 -fmodules -fmodule-cache-path %t -D__need_wint_t %s -Xclang -verify
+// expected-no-diagnostics
#ifdef __SSE__
@__experimental_modules_import _Builtin_intrinsics.intel.sse;
diff --git a/test/Modules/direct-module-import.m b/test/Modules/direct-module-import.m
new file mode 100644
index 0000000000000..317d7aea164b1
--- /dev/null
+++ b/test/Modules/direct-module-import.m
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -F %S/Inputs -include Module/Module.h %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: call i8* @getModuleVersion
+const char* getVer(void) {
+ return getModuleVersion();
+}
diff --git a/test/Modules/header-import.m b/test/Modules/header-import.m
index 5444854a62bfd..49549d0c671a8 100644
--- a/test/Modules/header-import.m
+++ b/test/Modules/header-import.m
@@ -1,5 +1,6 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s
+// expected-no-diagnostics
#import "point.h"
@__experimental_modules_import Module;
diff --git a/test/Modules/import-decl.cpp b/test/Modules/import-decl.cpp
index 76966934acc88..0f05f92708bc8 100644
--- a/test/Modules/import-decl.cpp
+++ b/test/Modules/import-decl.cpp
@@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: %clang -fmodule-cache-path %t -fmodules -x objective-c -I %S/Inputs -emit-ast -o %t.ast %s
-// RUN: %clang -cc1 -ast-print -x ast - < %t.ast | FileCheck %s
+// RUN: %clang_cc1 -ast-print -x ast - < %t.ast | FileCheck %s
@__experimental_modules_import import_decl;
// CHECK: struct T
diff --git a/test/Modules/inferred-frameworks.m b/test/Modules/inferred-frameworks.m
new file mode 100644
index 0000000000000..916c900b6457f
--- /dev/null
+++ b/test/Modules/inferred-frameworks.m
@@ -0,0 +1,8 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify
+
+#include <NotAModule/NotAModule.h>
+
+@__experimental_modules_import NotAModule; // expected-error{{module 'NotAModule' not found}}
+
+
diff --git a/test/Modules/inferred-submodules.m b/test/Modules/inferred-submodules.m
index bee1cec98e444..8c61bc081c2da 100644
--- a/test/Modules/inferred-submodules.m
+++ b/test/Modules/inferred-submodules.m
@@ -1,5 +1,6 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify
+// expected-no-diagnostics
@__experimental_modules_import Module.Sub;
diff --git a/test/Modules/macros.c b/test/Modules/macros.c
index 83e1c66a10171..8db3915f24a9c 100644
--- a/test/Modules/macros.c
+++ b/test/Modules/macros.c
@@ -1,8 +1,20 @@
// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros_top %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros_left %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros_right %S/Inputs/module.map
// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros %S/Inputs/module.map
// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodule-cache-path %t %s
// RUN: %clang_cc1 -E -fmodules -x objective-c -fmodule-cache-path %t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s
// FIXME: When we have a syntax for modules in C, use that.
+// These notes come from headers in modules, and are bogus.
+
+// FIXME: expected-note{{previous definition is here}}
+// expected-note{{other definition of 'LEFT_RIGHT_DIFFERENT'}}
+// expected-note{{expanding this definition of 'TOP_RIGHT_REDEF'}}
+// FIXME: expected-note{{previous definition is here}} \
+// expected-note{{expanding this definition of 'LEFT_RIGHT_DIFFERENT'}}
+
+// expected-note{{other definition of 'TOP_RIGHT_REDEF'}}
@__experimental_modules_import macros;
@@ -27,4 +39,99 @@ DOUBLE *dp = &d;
void f() {
// CHECK-PREPROCESSED: int i = INTEGER;
int i = INTEGER; // the value was exported, the macro was not.
+ i += macros; // expanded from __MODULE__ within the 'macros' module.
+}
+
+#ifdef __MODULE__
+# error Not building a module!
+#endif
+
+#if __building_module(macros)
+# error Not building a module
+#endif
+
+// None of the modules we depend on have been imported, and therefore
+// their macros should not be visible.
+#ifdef LEFT
+# error LEFT should not be visible
+#endif
+
+#ifdef RIGHT
+# error RIGHT should not be visible
+#endif
+
+#ifdef TOP
+# error TOP should not be visible
+#endif
+
+// Import left module (which also imports top)
+@__experimental_modules_import macros_left;
+
+#ifndef LEFT
+# error LEFT should be visible
+#endif
+
+#ifdef RIGHT
+# error RIGHT should not be visible
+#endif
+
+#ifndef TOP
+# error TOP should be visible
+#endif
+
+#ifdef TOP_LEFT_UNDEF
+# error TOP_LEFT_UNDEF should not be visible
+#endif
+
+void test1() {
+ int i;
+ TOP_RIGHT_REDEF *ip = &i;
}
+
+#define LEFT_RIGHT_DIFFERENT2 double // FIXME: expected-warning{{'LEFT_RIGHT_DIFFERENT2' macro redefined}}
+
+// Import right module (which also imports top)
+@__experimental_modules_import macros_right;
+
+#undef LEFT_RIGHT_DIFFERENT3
+
+#ifndef LEFT
+# error LEFT should be visible
+#endif
+
+#ifndef RIGHT
+# error RIGHT should be visible
+#endif
+
+#ifndef TOP
+# error TOP should be visible
+#endif
+
+void test2() {
+ int i;
+ float f;
+ double d;
+ TOP_RIGHT_REDEF *ip = &i; // expected-warning{{ambiguous expansion of macro 'TOP_RIGHT_REDEF'}}
+
+ LEFT_RIGHT_IDENTICAL *ip2 = &i;
+ LEFT_RIGHT_DIFFERENT *fp = &f; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT'}}
+ LEFT_RIGHT_DIFFERENT2 *dp = &d;
+ int LEFT_RIGHT_DIFFERENT3;
+}
+
+#define LEFT_RIGHT_DIFFERENT double // FIXME: expected-warning{{'LEFT_RIGHT_DIFFERENT' macro redefined}}
+
+void test3() {
+ double d;
+ LEFT_RIGHT_DIFFERENT *dp = &d; // okay
+}
+
+#ifndef TOP_RIGHT_UNDEF
+# error TOP_RIGHT_UNDEF should still be defined
+#endif
+
+@__experimental_modules_import macros_right.undef;
+
+#ifdef TOP_RIGHT_UNDEF
+# error TOP_RIGHT_UNDEF should not be defined
+#endif
diff --git a/test/Modules/modify-module.m b/test/Modules/modify-module.m
new file mode 100644
index 0000000000000..b630ac1058745
--- /dev/null
+++ b/test/Modules/modify-module.m
@@ -0,0 +1,23 @@
+// Test that if we modify one of the input files used to form a
+// header, that module and dependent modules get rebuilt.
+
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/include
+// RUN: cp %S/Inputs/Modified/A.h %t/include
+// RUN: cp %S/Inputs/Modified/B.h %t/include
+// RUN: cp %S/Inputs/Modified/module.map %t/include
+// RUN: %clang_cc1 -fmodule-cache-path %t/cache -fmodules -I %t/include %s -verify
+// expected-no-diagnostics
+// RUN: touch %t/include/B.h
+// RUN: %clang_cc1 -fmodule-cache-path %t/cache -fmodules -I %t/include %s -verify
+// RUN: echo 'int getA(); int getA2();' > %t/include/A.h
+// RUN: %clang_cc1 -fmodule-cache-path %t/cache -fmodules -I %t/include %s -verify
+
+@__experimental_modules_import B;
+
+int getValue() { return getA() + getB(); }
+
+
+
+
+
diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp
index 246dcaf80e249..31a3410a03f80 100644
--- a/test/Modules/module-private.cpp
+++ b/test/Modules/module-private.cpp
@@ -12,9 +12,12 @@ void test() {
}
int test_broken() {
- HiddenStruct hidden; // expected-error{{use of undeclared identifier 'HiddenStruct'}}
+ HiddenStruct hidden; // \
+ // expected-error{{must use 'struct' tag to refer to type 'HiddenStruct' in this scope}} \
+ // expected-error{{definition of 'struct HiddenStruct' must be imported}}
+ // expected-note@3 {{previous definition is here}}
- Integer i; // expected-error{{use of undeclared identifier 'Integer'}}
+ Integer i; // expected-error{{unknown type name 'Integer'}}
int *ip = 0;
f1(ip); // expected-error{{use of undeclared identifier 'f1'}}
diff --git a/test/Modules/normal-module-map.cpp b/test/Modules/normal-module-map.cpp
index 7cd448235d81f..07ca5ed9330a1 100644
--- a/test/Modules/normal-module-map.cpp
+++ b/test/Modules/normal-module-map.cpp
@@ -33,3 +33,13 @@ int testNestedUmbrellaBFail() {
int testNestedUmbrellaB() {
return nested_umbrella_b;
}
+
+@__experimental_modules_import nested_umbrella.a_extras;
+
+@__experimental_modules_import nested_umbrella._1;
+
+@__experimental_modules_import nested_umbrella.decltype_;
+
+int testSanitizedName() {
+ return extra_a + one + decltype_val;
+}
diff --git a/test/Modules/on-demand-macros.m b/test/Modules/on-demand-macros.m
index 2b8c5456eb65d..8b50529f1a28f 100644
--- a/test/Modules/on-demand-macros.m
+++ b/test/Modules/on-demand-macros.m
@@ -1,6 +1,7 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -DFOO_RETURNS_INT_PTR -verify %s
// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -verify %s
+// expected-no-diagnostics
@__experimental_modules_import CmdLine;
diff --git a/test/Modules/redecl-merge.m b/test/Modules/redecl-merge.m
index d7930aca2ecc2..d7224149a2829 100644
--- a/test/Modules/redecl-merge.m
+++ b/test/Modules/redecl-merge.m
@@ -1,6 +1,5 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -I %S/Inputs %s -verify -Wno-objc-root-class
-// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs %s -verify -Wno-objc-root-class
@class C2;
@class C3;
@class C3;
@@ -57,26 +56,26 @@ void testTagMerge() {
void testTypedefMerge(int i, double d) {
T1 *ip = &i;
- // in other file: expected-note{{candidate found by name lookup is 'T2'}}
// FIXME: Typedefs aren't actually merged in the sense of other merges, because
// we should only merge them when the types are identical.
- // in other file: expected-note{{candidate found by name lookup is 'T2'}}
- // in other file: expected-note{{candidate function}}
+ // in other file: expected-note@60{{candidate found by name lookup is 'T2'}}
+ // in other file: expected-note@63{{candidate found by name lookup is 'T2'}}
T2 *dp = &d; // expected-error{{reference to 'T2' is ambiguous}}
}
void testFuncMerge(int i) {
func0(i);
- // in other file: expected-note{{candidate function}}
func1(i);
+ // in other file: expected-note@64{{candidate function}}
+ // in other file: expected-note@70{{candidate function}}
func2(i); // expected-error{{call to 'func2' is ambiguous}}
}
void testVarMerge(int i) {
var1 = i;
- // in other files: expected-note 2{{candidate found by name lookup is 'var2'}}
+ // in other files: expected-note@77 2{{candidate found by name lookup is 'var2'}}
var2 = i; // expected-error{{reference to 'var2' is ambiguous}}
- // in other files: expected-note 2{{candidate found by name lookup is 'var3'}}
+ // in other files: expected-note@79 2{{candidate found by name lookup is 'var3'}}
var3 = i; // expected-error{{reference to 'var3' is ambiguous}}
}
@@ -146,13 +145,6 @@ void g(A *a) {
id<P4> p4;
id<P3> p3;
-#ifdef __cplusplus
-void testVector() {
- Vector<int> vec_int;
- vec_int.push_back(0);
-}
-#endif
-
// Make sure we don't get conflicts with 'id'.
funcptr_with_id fid;
id id_global;
diff --git a/test/Modules/redeclarations.m b/test/Modules/redeclarations.m
index 3f3e6954cc2ca..221e154cb2742 100644
--- a/test/Modules/redeclarations.m
+++ b/test/Modules/redeclarations.m
@@ -8,4 +8,5 @@
// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -emit-module -fmodule-name=redeclarations_left %S/Inputs/module.map
// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -emit-module -fmodule-name=redeclarations_right %S/Inputs/module.map
// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t %s -verify
+// expected-no-diagnostics
diff --git a/test/Modules/submodules.m b/test/Modules/submodules.m
index e014bead73b24..a758abc248dd2 100644
--- a/test/Modules/submodules.m
+++ b/test/Modules/submodules.m
@@ -1,6 +1,7 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify
+// expected-no-diagnostics
// Note: transitively imports Module.Sub2.
@__experimental_modules_import Module.Sub;
diff --git a/test/Modules/templates.mm b/test/Modules/templates.mm
new file mode 100644
index 0000000000000..45417401d86fd
--- /dev/null
+++ b/test/Modules/templates.mm
@@ -0,0 +1,36 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs -verify %s -Wno-objc-root-class
+// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs -emit-llvm %s -o - -Wno-objc-root-class | grep Emit | FileCheck %s
+// expected-no-diagnostics
+
+@__experimental_modules_import templates_left;
+@__experimental_modules_import templates_right;
+
+
+void testTemplateClasses() {
+ Vector<int> vec_int;
+ vec_int.push_back(0);
+
+ List<bool> list_bool;
+ list_bool.push_back(false);
+
+ N::Set<char> set_char;
+ set_char.insert('A');
+}
+
+void testPendingInstantiations() {
+ // CHECK: call {{.*pendingInstantiationEmit}}
+ // CHECK: call {{.*pendingInstantiationEmit}}
+ // CHECK: define {{.*pendingInstantiationEmit.*[(]i}}
+ // CHECK: define {{.*pendingInstantiationEmit.*[(]double}}
+ triggerPendingInstantiation();
+ triggerPendingInstantiationToo();
+}
+
+void testRedeclDefinition() {
+ // CHECK: define {{.*redeclDefinitionEmit}}
+ redeclDefinitionEmit();
+}
+
+// CHECK: call {{.*pendingInstantiation}}
+// CHECK: call {{.*redeclDefinitionEmit}}