[modules] When a declaration has non-trivial visibility, check whether it's

actually hidden before we check its linkage. This avoids computing the linkage
"too early" for an anonymous struct with a typedef name for linkage.

llvm-svn: 253012
This commit is contained in:
Richard Smith 2015-11-13 05:14:45 +00:00
parent 978cbc54bc
commit 6e132bef6f
2 changed files with 8 additions and 2 deletions

View 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);

View 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;