From 37604a09841c733cfeef9c190bddac66ea7da905 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). llvm-svn: 71873 --- clang/lib/CodeGen/CodeGenModule.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 706a97354e4..2c966150df2 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/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