aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-02-08 22:28:39 +0000
committerJohn McCall <rjmccall@apple.com>2011-02-08 22:28:39 +0000
commitf9536f4c843c6df49f1083b4b0300da8a0883645 (patch)
tree056437536e55ed93575a0daf1ea9adcd0deaa293
parent4800a5c79023271408af49797e09be32aca93232 (diff)
Test case accidentally left out of my last commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125119 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/SemaCXX/linkage.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/SemaCXX/linkage.cpp b/test/SemaCXX/linkage.cpp
new file mode 100644
index 0000000000..fb21f94e92
--- /dev/null
+++ b/test/SemaCXX/linkage.cpp
@@ -0,0 +1,57 @@
+// This is an IR generation test because the calculation of visibility
+// during IR gen will cause linkage to be implicitly recomputed and
+// compared against the earlier cached value. If we had a way of
+// testing linkage directly in Sema, that would be better.
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s
+
+// PR8926
+namespace test0 {
+ typedef struct {
+ void *foo() { return 0; }
+ } A;
+
+ // CHECK: define linkonce_odr i8* @_ZN5test01A3fooEv(
+
+ void test(A *a) {
+ a->foo();
+ }
+}
+
+namespace test1 {
+ typedef struct {
+ template <unsigned n> void *foo() { return 0; }
+
+ void foo() {
+ foo<0>();
+ }
+ } A;
+
+ // CHECK: define linkonce_odr void @_ZN5test11A3fooEv(
+ // another at the end
+
+ void test(A *a) {
+ a->foo();
+ }
+}
+
+namespace test2 {
+ typedef struct {
+ template <unsigned n> struct B {
+ void *foo() { return 0; }
+ };
+
+ void foo(B<0> *b) {
+ b->foo();
+ }
+ } A;
+
+ // CHECK: define linkonce_odr void @_ZN5test21A3fooEPNS0_1BILj0EEE(
+
+ void test(A *a) {
+ a->foo(0);
+ }
+}
+
+// CHECK: define linkonce_odr i8* @_ZN5test21A1BILj0EE3fooEv(
+// CHECK: define linkonce_odr i8* @_ZN5test11A3fooILj0EEEPvv(