aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-02 20:08:44 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-02 20:08:44 +0000
commit10ce9321551efffa6ed2cff39084400e1dfcf307 (patch)
treec6e811515f3055db88a59e162eeebdf4648811cb
parent5fdc1b993dcb01e8a994fdacfc4eb089832c82e3 (diff)
Make sure that name lookup in C checks whether a name is hidden.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145700 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaLookup.cpp5
-rw-r--r--test/Modules/Inputs/module.map16
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 5964d7232a..c232515ef3 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -1123,6 +1123,11 @@ bool Sema::LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation) {
!isa<ImplicitParamDecl>(*I))
continue;
+ // If this declaration is module-private and it came from an AST
+ // file, we can't see it.
+ if ((*I)->isModulePrivate() && (*I)->isFromASTFile())
+ continue;
+
R.addDecl(*I);
if ((*I)->getAttr<OverloadableAttr>()) {
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index d18b9f7505..7d8d11f957 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -21,9 +21,19 @@ module module_private_left { header "module_private_left.h" }
module module_private_right { header "module_private_right.h" }
module macros { header "macros.h" }
module category_top { header "category_top.h" }
-module category_left { header "category_left.h" }
-module category_right { header "category_right.h" }
-module category_bottom { header "category_bottom.h" }
+module category_left {
+ header "category_left.h"
+ export category_top
+}
+module category_right {
+ header "category_right.h"
+ export category_top
+}
+module category_bottom {
+ header "category_bottom.h"
+ export category_left
+ export category_right
+}
module redeclarations_left { header "redeclarations_left.h" }
module redeclarations_right { header "redeclarations_right.h" }
module load_failure { header "load_failure.h" }