From 167b824ce1947bf71ec8a71296daa2c54ebe58df Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Fri, 15 May 2009 18:35:39 +0000 Subject: A C++ member function always has either weak linkage (if it's inline or defined inline) or strong linkage (other cases). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71873 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 706a97354e..2c966150df 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -241,6 +241,14 @@ void CodeGenModule::EmitAnnotations() { static CodeGenModule::GVALinkage GetLinkageForFunction(const FunctionDecl *FD, const LangOptions &Features) { + if (const CXXMethodDecl *MD = dyn_cast(FD)) { + // C++ member functions defined inside the class are always inline. + if (MD->isInline() || !MD->isOutOfLineDefinition()) + return CodeGenModule::GVA_CXXInline; + + return CodeGenModule::GVA_StrongExternal; + } + // "static" functions get internal linkage. if (FD->getStorageClass() == FunctionDecl::Static) return CodeGenModule::GVA_Internal; -- cgit v1.2.3