summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGRTTI.cpp5
-rw-r--r--clang/test/CodeGenCXX/rtti-linkage.cpp16
2 files changed, 17 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGRTTI.cpp b/clang/lib/CodeGen/CGRTTI.cpp
index c8ce4ec6b99..24b3efff6d9 100644
--- a/clang/lib/CodeGen/CGRTTI.cpp
+++ b/clang/lib/CodeGen/CGRTTI.cpp
@@ -257,10 +257,7 @@ public:
e = RD->bases_end(); i != e; ++i) {
const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
- if (Base->isPolymorphic())
- info.push_back(CGM.GenerateRTTIRef(Base));
- else
- info.push_back(CGM.GenerateRTTI(Base));
+ info.push_back(CGM.GetAddrOfRTTI(Base));
if (simple)
break;
int64_t offset;
diff --git a/clang/test/CodeGenCXX/rtti-linkage.cpp b/clang/test/CodeGenCXX/rtti-linkage.cpp
new file mode 100644
index 00000000000..a2a1cdd48c1
--- /dev/null
+++ b/clang/test/CodeGenCXX/rtti-linkage.cpp
@@ -0,0 +1,16 @@
+// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+// CHECK: _ZTS1B = constant
+// CHECK: _ZTS1A = weak_odr constant
+// CHECK: _ZTI1A = weak_odr constant
+// CHECK: _ZTI1B = constant
+
+// A has no key function, so its RTTI data should be weak_odr.
+struct A { };
+
+// B has a key function defined in the translation unit, so the RTTI data should
+// be emitted in this translation unit and have external linkage.
+struct B : A {
+ virtual void f();
+};
+void B::f() { }
OpenPOWER on IntegriCloud