From 97135cc94a8fcc1ec9b04e4db4ef08c18081b8be Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 12 Nov 2015 22:19:45 +0000 Subject: [modules] Simplify and generalize the existing rule for finding hidden declarations in redeclaration lookup. A declaration is now visible to lookup if: * It is visible (not in a module, or in an imported module), or * We're doing redeclaration lookup and it's externally-visible, or * We're doing typo correction and looking for unimported decls. We now support multiple modules having different internal-linkage or no-linkage definitions of the same name for all entities, not just for functions, variables, and some typedefs. As previously, if multiple such entities are visible, any attempt to use them will result in an ambiguity error. This patch fixes the linkage calculation for a number of entities where we previously didn't need to get it right (using-declarations, namespace aliases, and so on). It also classifies enumerators as always having no linkage, which is a slight deviation from the C++ standard's definition, but not an observable change outside modules (this change is being discussed on the -core reflector currently). This also removes the prior special case for tag lookup, which made some cases of this work, but also led to bizarre, bogus "must use 'struct' to refer to type 'Foo' in this scope" diagnostics in C++. llvm-svn: 252960 --- clang/lib/Sema/SemaDecl.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'clang/lib/Sema/SemaDecl.cpp') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 728697e78f5..a23d9debb86 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -4819,12 +4819,6 @@ NamedDecl *Sema::HandleDeclarator(Scope *S, Declarator &D, LookupResult Previous(*this, NameInfo, LookupOrdinaryName, ForRedeclaration); - // If we're hiding internal-linkage symbols in modules from redeclaration - // lookup, let name lookup know. - if ((getLangOpts().Modules || getLangOpts().ModulesLocalVisibility) && - D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_typedef) - Previous.setAllowHiddenInternal(false); - // See if this is a redefinition of a variable in the same scope. if (!D.getCXXScopeSpec().isSet()) { bool IsLinkageLookup = false; -- cgit v1.2.3