summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-15 18:35:39 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-15 18:35:39 +0000
commit37604a09841c733cfeef9c190bddac66ea7da905 (patch)
tree6e9d6e03f9f9f2f65c1e0df131b44742f160880b /clang/lib/CodeGen/CodeGenModule.cpp
parent82049e6bdd566630518362ac197bbc32f8411cb6 (diff)
downloadbcm5719-llvm-37604a09841c733cfeef9c190bddac66ea7da905.tar.gz
bcm5719-llvm-37604a09841c733cfeef9c190bddac66ea7da905.zip
A C++ member function always has either weak linkage (if it's inline or defined inline) or strong linkage (other cases).
llvm-svn: 71873
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp8
1 files changed, 8 insertions, 0 deletions
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<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;
OpenPOWER on IntegriCloud