aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGRTTI.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-12-31 19:36:25 +0000
committerAnders Carlsson <andersca@mac.com>2009-12-31 19:36:25 +0000
commite8f90389c43efbbe820574f674a98ac701bf48a2 (patch)
treee3e7b981c3cad5de05165c69cfabc6d367e8b91d /lib/CodeGen/CGRTTI.cpp
parentac4c939c2dfca2dc5b785169670125511ea5bb62 (diff)
If the key function of a record is inline, then the RTTI data should have weak_odr linkage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92371 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGRTTI.cpp')
-rw-r--r--lib/CodeGen/CGRTTI.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp
index b00b9155e8..db6c5075ed 100644
--- a/lib/CodeGen/CGRTTI.cpp
+++ b/lib/CodeGen/CGRTTI.cpp
@@ -372,6 +372,14 @@ static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(QualType Ty) {
return llvm::GlobalValue::WeakODRLinkage;
}
+ // If the key function is defined, but inlined, then the RTTI descriptor is
+ // emitted with weak_odr linkage.
+ const FunctionDecl* KeyFunctionDefinition;
+ KeyFunction->getBody(KeyFunctionDefinition);
+
+ if (KeyFunctionDefinition->isInlined())
+ return llvm::GlobalValue::WeakODRLinkage;
+
// Otherwise, the RTTI descriptor is emitted with external linkage.
return llvm::GlobalValue::ExternalLinkage;
}