aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index d2be5af14a..6338402579 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -190,9 +190,11 @@ CodeGenModule::getDeclVisibilityMode(const Decl *D) const {
return LangOptions::Hidden;
}
- // This decl should have the same visibility as its parent.
+ // If this decl is contained in a class, it should have the same visibility
+ // as the parent class.
if (const DeclContext *DC = D->getDeclContext())
- return getDeclVisibilityMode(cast<Decl>(DC));
+ if (DC->isRecord())
+ return getDeclVisibilityMode(cast<Decl>(DC));
return getLangOptions().getVisibilityMode();
}