summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2017-07-01 00:06:27 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2017-07-01 00:06:27 +0000
commit057c82cf25a0c8bd4150eb715310b1d74a538aac (patch)
tree34cd387011d23fc2b37f27f53b6435a3866412f2 /clang/lib/AST/Decl.cpp
parentad923425ac3e79e4b9722fcd9df3141b597314b7 (diff)
downloadbcm5719-llvm-057c82cf25a0c8bd4150eb715310b1d74a538aac.tar.gz
bcm5719-llvm-057c82cf25a0c8bd4150eb715310b1d74a538aac.zip
Change enumerator default linkage type for C
Redeclaration lookup should never find hidden enumerators in C, because they do not have linkage (C11 6.2.2/6) The linkage of an enumerator should be VisibleNoLinkage, and isHiddenDeclarationVisible should be checking hasExternalFormalLinkage. This is was reviewed as part of D31778, but splitted into a different commit for clarity. rdar://problem/31909368 llvm-svn: 306917
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 8677b1155a6..267c6992af8 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1251,7 +1251,9 @@ static LinkageInfo computeLVForDecl(const NamedDecl *D,
case Decl::EnumConstant:
// C++ [basic.link]p4: an enumerator has the linkage of its enumeration.
- return getLVForDecl(cast<EnumDecl>(D->getDeclContext()), computation);
+ if (D->getASTContext().getLangOpts().CPlusPlus)
+ return getLVForDecl(cast<EnumDecl>(D->getDeclContext()), computation);
+ return LinkageInfo::visible_none();
case Decl::Typedef:
case Decl::TypeAlias:
OpenPOWER on IntegriCloud