aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-09 18:32:39 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-09 18:32:39 +0000
commit6311d2bb3db1ec1064f45a14983ae5806adc676a (patch)
tree5cb041fdf6634ccfabccd3d7122c3d7788ade952 /lib/Sema/SemaDecl.cpp
parentbbcb7ea8a062a8f1d5cb504e4518a5d4fbab873a (diff)
Propagate __module_private__ from previous declarations to later
declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139380 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 881fb86a78..4a7be55366 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1394,6 +1394,10 @@ void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) {
if (TypedefNameDecl *Typedef = dyn_cast<TypedefNameDecl>(Old))
New->setPreviousDeclaration(Typedef);
+ // __module_private__ is propagated to later declarations.
+ if (Old->isModulePrivate())
+ New->setModulePrivate();
+
if (getLangOptions().Microsoft)
return;
@@ -1959,6 +1963,10 @@ bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old) {
if (Old->isPure())
New->setPure();
+ // __module_private__ is propagated to later declarations.
+ if (Old->isModulePrivate())
+ New->setModulePrivate();
+
// Merge attributes from the parameters. These can mismatch with K&R
// declarations.
if (New->getNumParams() == Old->getNumParams())
@@ -2141,6 +2149,10 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
return New->setInvalidDecl();
}
+ // __module_private__ is propagated to later declarations.
+ if (Old->isModulePrivate())
+ New->setModulePrivate();
+
// Variables with external linkage are analyzed in FinalizeDeclaratorGroup.
// FIXME: The test for external storage here seems wrong? We still
@@ -5242,6 +5254,10 @@ void Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
NewTemplateDecl->setMemberSpecialization();
assert(OldTemplateDecl->isMemberSpecialization());
}
+
+ if (OldTemplateDecl->isModulePrivate())
+ NewTemplateDecl->setModulePrivate();
+
} else {
if (isa<CXXMethodDecl>(NewFD)) // Set access for out-of-line definitions
NewFD->setAccess(OldDecl->getAccess());
@@ -7726,7 +7742,9 @@ CreateNewDecl:
AddMsStructLayoutForRecord(RD);
}
- if (IsModulePrivate)
+ if (PrevDecl && PrevDecl->isModulePrivate())
+ New->setModulePrivate();
+ else if (IsModulePrivate)
New->setModulePrivate();
// If this is a specialization of a member class (of a class template),