summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-06-20 01:05:19 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-06-20 01:05:19 +0000
commit55d857b142b0ccc0b3a53b0e510e527b0df409c6 (patch)
tree093e6a7980646ce9149ca27b4cdc06c04ccda159 /test
parent16908095612cbd959ec24c8461c469d49326a4f3 (diff)
downloadclang-55d857b142b0ccc0b3a53b0e510e527b0df409c6.tar.gz
[modules] When determining whether a definition of a class is visible, check all modules even if we've already found a definition that's not visible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240204 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Modules/Inputs/merge-class-definition-visibility/a.h1
-rw-r--r--test/Modules/Inputs/merge-class-definition-visibility/b.h2
-rw-r--r--test/Modules/Inputs/merge-class-definition-visibility/c.h1
-rw-r--r--test/Modules/Inputs/merge-class-definition-visibility/d.h1
-rw-r--r--test/Modules/Inputs/merge-class-definition-visibility/modmap7
-rw-r--r--test/Modules/merge-class-definition-visibility.cpp15
6 files changed, 27 insertions, 0 deletions
diff --git a/test/Modules/Inputs/merge-class-definition-visibility/a.h b/test/Modules/Inputs/merge-class-definition-visibility/a.h
new file mode 100644
index 0000000000..4c5cd949f2
--- /dev/null
+++ b/test/Modules/Inputs/merge-class-definition-visibility/a.h
@@ -0,0 +1 @@
+struct A {};
diff --git a/test/Modules/Inputs/merge-class-definition-visibility/b.h b/test/Modules/Inputs/merge-class-definition-visibility/b.h
new file mode 100644
index 0000000000..2b8f5f868e
--- /dev/null
+++ b/test/Modules/Inputs/merge-class-definition-visibility/b.h
@@ -0,0 +1,2 @@
+// Include definition of A into the same module as c.h
+#include "a.h"
diff --git a/test/Modules/Inputs/merge-class-definition-visibility/c.h b/test/Modules/Inputs/merge-class-definition-visibility/c.h
new file mode 100644
index 0000000000..27f503c2c6
--- /dev/null
+++ b/test/Modules/Inputs/merge-class-definition-visibility/c.h
@@ -0,0 +1 @@
+struct A;
diff --git a/test/Modules/Inputs/merge-class-definition-visibility/d.h b/test/Modules/Inputs/merge-class-definition-visibility/d.h
new file mode 100644
index 0000000000..2243de1baf
--- /dev/null
+++ b/test/Modules/Inputs/merge-class-definition-visibility/d.h
@@ -0,0 +1 @@
+#include "a.h"
diff --git a/test/Modules/Inputs/merge-class-definition-visibility/modmap b/test/Modules/Inputs/merge-class-definition-visibility/modmap
new file mode 100644
index 0000000000..7d988fbba0
--- /dev/null
+++ b/test/Modules/Inputs/merge-class-definition-visibility/modmap
@@ -0,0 +1,7 @@
+module Def1 {
+ module B { header "b.h" }
+ module C { header "c.h" }
+}
+module Def2 {
+ header "d.h"
+}
diff --git a/test/Modules/merge-class-definition-visibility.cpp b/test/Modules/merge-class-definition-visibility.cpp
new file mode 100644
index 0000000000..e8602c0d54
--- /dev/null
+++ b/test/Modules/merge-class-definition-visibility.cpp
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodule-map-file=%S/Inputs/merge-class-definition-visibility/modmap \
+// RUN: -I%S/Inputs/merge-class-definition-visibility \
+// RUN: -fmodules-cache-path=%t %s -verify
+// expected-no-diagnostics
+
+#include "c.h"
+template<typename T> struct X { T t; };
+typedef X<A> XA;
+
+#include "d.h"
+// Ensure that this triggers the import of the second definition from d.h,
+// which is necessary to make the definition of A visible in the template
+// instantiation.
+XA xa;