r253012 - [modules] When a declaration has non-trivial visibility, check whether it's
Sean Silva via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 13 19:23:43 PST 2015
On Thu, Nov 12, 2015 at 9:14 PM, Richard Smith via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: rsmith
> Date: Thu Nov 12 23:14:45 2015
> New Revision: 253012
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253012&view=rev
> Log:
> [modules] When a declaration has non-trivial visibility, check whether it's
>
What is "non-trivial visibility"? Is this "visibility" something that
exists in the present C++ language? (e.g. `using namespace std` etc.) or is
this a different notion?
-- Sean Silva
> actually hidden before we check its linkage. This avoids computing the
> linkage
> "too early" for an anonymous struct with a typedef name for linkage.
>
> Modified:
> cfe/trunk/include/clang/Sema/Lookup.h
> cfe/trunk/test/Modules/submodule-visibility.cpp
>
> Modified: cfe/trunk/include/clang/Sema/Lookup.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012&r1=253011&r2=253012&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Sema/Lookup.h (original)
> +++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 23:14:45 2015
> @@ -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);
>
> Modified: cfe/trunk/test/Modules/submodule-visibility.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012&r1=253011&r2=253012&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Modules/submodule-visibility.cpp (original)
> +++ cfe/trunk/test/Modules/submodule-visibility.cpp Thu Nov 12 23:14:45
> 2015
> @@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visibl
> #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;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151113/424a9d34/attachment.html>
More information about the cfe-commits
mailing list