diff options
author | Anders Carlsson <andersca@mac.com> | 2009-05-15 18:35:39 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-05-15 18:35:39 +0000 |
commit | 167b824ce1947bf71ec8a71296daa2c54ebe58df (patch) | |
tree | 5e9e5d27e956c749ba401e03656ffc5ffd99c781 /lib/CodeGen/CodeGenModule.cpp | |
parent | b70ccad30c7854f29c44d9bdd26c70754d28d3fe (diff) |
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
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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<CXXMethodDecl>(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; |