<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 14, 2015 at 2:30 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><p dir="ltr">On Nov 13, 2015 7:23 PM, "Sean Silva" <<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Thu, Nov 12, 2015 at 9:14 PM, Richard Smith via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br>
>><br>
>> Author: rsmith<br>
>> Date: Thu Nov 12 23:14:45 2015<br>
>> New Revision: 253012<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=253012&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=253012&view=rev</a><br>
>> Log:<br>
>> [modules] When a declaration has non-trivial visibility, check whether it's<br>
><br>
><br>
> 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?</p>
</span><p dir="ltr">This is the modules notion of visibility (whether the declaration has been imported or not). Here, non-trivial visibility means "not known to be unconditionally visible", and corresponds to the Hidden flag on the Decl being true.</p></blockquote><div><br></div><div>I just looked at the comment on the `Hidden` flag and it doesn't seem to mention anything about being "trivial" or "non-trivial". Why say "declaration has non-trivial visibility" instead of just "declaration is hidden"? Do they mean different things?</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
<p dir="ltr">> -- Sean Silva<br>
>  <br>
>><br>
>> actually hidden before we check its linkage. This avoids computing the linkage<br>
>> "too early" for an anonymous struct with a typedef name for linkage.<br>
>><br>
>> Modified:<br>
>>     cfe/trunk/include/clang/Sema/Lookup.h<br>
>>     cfe/trunk/test/Modules/submodule-visibility.cpp<br>
>><br>
>> Modified: cfe/trunk/include/clang/Sema/Lookup.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012&r1=253011&r2=253012&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012&r1=253011&r2=253012&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/include/clang/Sema/Lookup.h (original)<br>
>> +++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 23:14:45 2015<br>
>> @@ -303,8 +303,7 @@ public:<br>
>>      if (!D->isInIdentifierNamespace(IDNS))<br>
>>        return nullptr;<br>
>><br>
>> -    if (!D->isHidden() || isHiddenDeclarationVisible(D) ||<br>
>> -        isVisibleSlow(getSema(), D))<br>
>> +    if (isVisible(getSema(), D) || isHiddenDeclarationVisible(D))<br>
>>        return D;<br>
>><br>
>>      return getAcceptableDeclSlow(D);<br>
>><br>
>> Modified: cfe/trunk/test/Modules/submodule-visibility.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012&r1=253011&r2=253012&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012&r1=253011&r2=253012&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/test/Modules/submodule-visibility.cpp (original)<br>
>> +++ cfe/trunk/test/Modules/submodule-visibility.cpp Thu Nov 12 23:14:45 2015<br>
>> @@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visibl<br>
>>  #ifndef B<br>
>>  #error B is not defined<br>
>>  #endif<br>
>> +<br>
>> +// Ensure we don't compute the linkage of this struct before we find it has a<br>
>> +// typedef name for linkage purposes.<br>
>> +typedef struct {<br>
>> +  int p;<br>
>> +  void (*f)(int p);<br>
>> +} name_for_linkage;<br>
>><br>
>><br>
>> _______________________________________________<br>
>> cfe-commits mailing list<br>
>> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
><br>
><br>
</p>
</div></div></blockquote></div><br></div></div>