aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-10-26 04:59:26 +0000
committerJohn McCall <rjmccall@apple.com>2010-10-26 04:59:26 +0000
commitac65c6208d48b0f9b4661c30c28997a280ac5ba6 (patch)
treeead6d222141d69c1252b787ec497789c559be297 /lib/AST/DeclBase.cpp
parent1235b0ebb16618bf41a9e7234d5e2690faf97d37 (diff)
A couple of tweaks to the visibility rules:
- tags with C linkage should ignore visibility=hidden - functions and variables with explicit visibility attributes should ignore the linkage of their types Either of these should be sufficient to fix PR8457. Also, FileCheck-ize a test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r--lib/AST/DeclBase.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index 483352f2d6..5606d54478 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -529,6 +529,17 @@ bool DeclContext::isTransparentContext() const {
return false;
}
+bool DeclContext::isExternCContext() const {
+ const DeclContext *DC = this;
+ while (DC->DeclKind != Decl::TranslationUnit) {
+ if (DC->DeclKind == Decl::LinkageSpec)
+ return cast<LinkageSpecDecl>(DC)->getLanguage()
+ == LinkageSpecDecl::lang_c;
+ DC = DC->getParent();
+ }
+ return false;
+}
+
bool DeclContext::Encloses(const DeclContext *DC) const {
if (getPrimaryContext() != this)
return getPrimaryContext()->Encloses(DC);