aboutsummaryrefslogtreecommitdiff
path: root/test/Modules/Inputs
diff options
context:
space:
mode:
authorAxel Naumann <Axel.Naumann@cern.ch>2012-10-02 09:09:43 +0000
committerAxel Naumann <Axel.Naumann@cern.ch>2012-10-02 09:09:43 +0000
commit39d26c3e499470cd80a3e6f26f11ac681cd9712c (patch)
tree29e424007f5364bcd619aa1ecc53eaf0c58e35d7 /test/Modules/Inputs
parentb7bafa94bc583af9b825b5049aed50359fdb844b (diff)
Merge pending instantiations instead of overwriting existing ones.
Check whether a pending instantiation needs to be instantiated (or whether an instantiation already exists). Verify the size of the PendingInstantiations record (was only checking size of existing PendingInstantiations). Migrate Obj-C++ part of redecl-merge into separate test, now that this is growing. templates.mm: test that CodeGen has seen exactly one definition of template instantiations. redecl-merge.m: use "@" specifier for expected-diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164993 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules/Inputs')
-rw-r--r--test/Modules/Inputs/module.map12
-rw-r--r--test/Modules/Inputs/redecl-merge-bottom.h8
-rw-r--r--test/Modules/Inputs/redecl-merge-left.h21
-rw-r--r--test/Modules/Inputs/redecl-merge-right.h20
-rw-r--r--test/Modules/Inputs/redecl-merge-top.h9
-rw-r--r--test/Modules/Inputs/templates-left.h27
-rw-r--r--test/Modules/Inputs/templates-right.h25
-rw-r--r--test/Modules/Inputs/templates-top.h6
8 files changed, 70 insertions, 58 deletions
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index 79056cb518..9044922799 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -78,6 +78,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"
}
diff --git a/test/Modules/Inputs/redecl-merge-bottom.h b/test/Modules/Inputs/redecl-merge-bottom.h
index 40a9404abf..cfea7dc87d 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 1f5da4f2e2..ee794ff320 100644
--- a/test/Modules/Inputs/redecl-merge-left.h
+++ b/test/Modules/Inputs/redecl-merge-left.h
@@ -78,27 +78,6 @@ extern float var2;
extern double var3;
-#ifdef __cplusplus
-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);
- };
-}
-#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 2e05c035c5..f62020f205 100644
--- a/test/Modules/Inputs/redecl-merge-right.h
+++ b/test/Modules/Inputs/redecl-merge-right.h
@@ -78,26 +78,6 @@ extern int var2;
static double var3;
-#ifdef __cplusplus
-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);
- };
-}
-#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 7053936b2c..25456deb28 100644
--- a/test/Modules/Inputs/redecl-merge-top.h
+++ b/test/Modules/Inputs/redecl-merge-top.h
@@ -14,12 +14,3 @@
struct S1;
struct S2;
struct S2;
-
-#ifdef __cplusplus
-template<typename T> class Vector;
-
-template<typename T> class List {
-public:
- void push_back(T);
-};
-#endif
diff --git a/test/Modules/Inputs/templates-left.h b/test/Modules/Inputs/templates-left.h
new file mode 100644
index 0000000000..7f50cd4c4f
--- /dev/null
+++ b/test/Modules/Inputs/templates-left.h
@@ -0,0 +1,27 @@
+@__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 pendingInstantiation(T) {}
+void triggerPendingInstantiation() {
+ pendingInstantiation(12);
+ pendingInstantiation(42.);
+}
diff --git a/test/Modules/Inputs/templates-right.h b/test/Modules/Inputs/templates-right.h
new file mode 100644
index 0000000000..f5487fb0e1
--- /dev/null
+++ b/test/Modules/Inputs/templates-right.h
@@ -0,0 +1,25 @@
+@__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 pendingInstantiation(T) {}
+void triggerPendingInstantiationToo() {
+ pendingInstantiation(12);
+}
diff --git a/test/Modules/Inputs/templates-top.h b/test/Modules/Inputs/templates-top.h
new file mode 100644
index 0000000000..80ecf23ea4
--- /dev/null
+++ b/test/Modules/Inputs/templates-top.h
@@ -0,0 +1,6 @@
+template<typename T> class Vector;
+
+template<typename T> class List {
+public:
+ void push_back(T);
+};