]> granicus.if.org Git - clang/commitdiff
[modules] When a declaration has non-trivial visibility, check whether it's
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 13 Nov 2015 05:14:45 +0000 (05:14 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 13 Nov 2015 05:14:45 +0000 (05:14 +0000)
actually hidden before we check its linkage. This avoids computing the linkage
"too early" for an anonymous struct with a typedef name for linkage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253012 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/Lookup.h
test/Modules/submodule-visibility.cpp

index f291a8aef0597711e6fc34393dab86016b89567b..87c40f0cf206200495724ce261f4d17feb330cb0 100644 (file)
@@ -303,8 +303,7 @@ public:
     if (!D->isInIdentifierNamespace(IDNS))
       return nullptr;
 
-    if (!D->isHidden() || isHiddenDeclarationVisible(D) ||
-        isVisibleSlow(getSema(), D))
+    if (isVisible(getSema(), D) || isHiddenDeclarationVisible(D))
       return D;
 
     return getAcceptableDeclSlow(D);
index b2c5fc7ba198e4757df89ced84248fb9a3b1767f..345ae155bb323795a45670f0d99e8178c2667395 100644 (file)
@@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visible here.
 #ifndef B
 #error B is not defined
 #endif
+
+// Ensure we don't compute the linkage of this struct before we find it has a
+// typedef name for linkage purposes.
+typedef struct {
+  int p;                 
+  void (*f)(int p);                                                                       
+} name_for_linkage;