Skip to content
Snippets Groups Projects
Commit 2a187521 authored by Richard Smith's avatar Richard Smith
Browse files

[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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253012 91177308-0d34-0410-b5e6-96231b3b80d8
parent 1c0a6285
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment