aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGRTTI.cpp
diff options
context:
space:
mode:
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;
}