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
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp
index b00b915..db6c507 100644
--- a/lib/CodeGen/CGRTTI.cpp
+++ b/lib/CodeGen/CGRTTI.cpp
@@ -372,6 +372,14 @@
       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;
   }