summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-14 21:29:40 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-14 21:29:40 +0000
commit3cc3cdeea96c6a3c024e3c47daad2853e8017d6e (patch)
tree2a683cf77fdf7c23a9ba5c73a1de62bea42930d6 /clang/lib/AST
parentb1d6fde13e529e7a5217e2b7c48c0437cea9dee5 (diff)
downloadbcm5719-llvm-3cc3cdeea96c6a3c024e3c47daad2853e8017d6e.tar.gz
bcm5719-llvm-3cc3cdeea96c6a3c024e3c47daad2853e8017d6e.zip
Give explicit and implicit instantiations of static data members of
class templates the proper linkage. Daniel, please look over the CodeGenModule bits. llvm-svn: 84140
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/Decl.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index a908299bfe0..da7959b16f9 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -373,7 +373,23 @@ SourceRange VarDecl::getSourceRange() const {
return SourceRange(getLocation(), getLocation());
}
-VarDecl *VarDecl::getInstantiatedFromStaticDataMember() {
+bool VarDecl::isOutOfLine() const {
+ if (!isStaticDataMember())
+ return false;
+
+ if (Decl::isOutOfLine())
+ return true;
+
+ // If this static data member was instantiated from a static data member of
+ // a class template, check whether that static data member was defined
+ // out-of-line.
+ if (VarDecl *VD = getInstantiatedFromStaticDataMember())
+ return VD->isOutOfLine();
+
+ return false;
+}
+
+VarDecl *VarDecl::getInstantiatedFromStaticDataMember() const {
if (MemberSpecializationInfo *MSI = getMemberSpecializationInfo())
return cast<VarDecl>(MSI->getInstantiatedFrom());
@@ -388,7 +404,7 @@ TemplateSpecializationKind VarDecl::getTemplateSpecializationKind() const {
return TSK_Undeclared;
}
-MemberSpecializationInfo *VarDecl::getMemberSpecializationInfo() {
+MemberSpecializationInfo *VarDecl::getMemberSpecializationInfo() const {
return getASTContext().getInstantiatedFromStaticDataMember(this);
}
@@ -809,7 +825,6 @@ FunctionDecl::setTemplateSpecializationKind(TemplateSpecializationKind TSK) {
}
bool FunctionDecl::isOutOfLine() const {
- // FIXME: Should we restrict this to member functions?
if (Decl::isOutOfLine())
return true;
OpenPOWER on IntegriCloud