r175326 - Rework the visibility computation algorithm in preparation

Nico Weber thakis at chromium.org
Sun Feb 24 13:41:05 PST 2013


On Fri, Feb 22, 2013 at 12:49 AM, John McCall <rjmccall at apple.com> wrote:
> On Feb 21, 2013, at 2:28 PM, John McCall <rjmccall at apple.com> wrote:
>> On Feb 21, 2013, at 12:53 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
>>>> Yes, TNorthover just pointed that to me on IRC. I guess we should just
>>>> not call getLVForDecl on the class when we have an explicit
>>>> specialization of a member of a class template. It would look just for
>>>> the template arguments, but we want to ignore them.
>>>
>>> I decided to give that a try and looks like it works.
>>
>> You can't just not call getLVForDecl on the class;  you just want to ignore
>> visibility, not linkage.
>>
>> I'm working on a more complete patch anyway.
>
> Committed as r175827.

Thanks!

I found one more bug, with problem (1). It looks like the first
declaration of a type must be marked visible, not just any declaration
before an instantiation with that type:

$ cat test.cc
#define EXPORT __attribute__((visibility("default")))

class Layer;  // Fine without this.
class EXPORT Layer;

template <typename LayerType>
struct EXPORT OcclusionTrackerBase {
  OcclusionTrackerBase();
};

template <typename LayerType>
OcclusionTrackerBase<LayerType>::OcclusionTrackerBase() {}

template struct OcclusionTrackerBase<Layer>;

$ ~/src/llvm/Release+Asserts/bin/clang -c test.cc -fvisibility=hidden
$ nm -m test.o
0000000000000070 (__TEXT,__eh_frame) non-external EH_frame0
0000000000000000 (__TEXT,__textcoal_nt) weak private external
__ZN20OcclusionTrackerBaseI5LayerEC1Ev
0000000000000088 (__TEXT,__eh_frame) weak private external
__ZN20OcclusionTrackerBaseI5LayerEC1Ev.eh
0000000000000020 (__TEXT,__textcoal_nt) weak private external
__ZN20OcclusionTrackerBaseI5LayerEC2Ev
00000000000000b0 (__TEXT,__eh_frame) weak private external
__ZN20OcclusionTrackerBaseI5LayerEC2Ev.eh
$ ~/src/llvm/Release+Asserts/bin/clang --version
clang version 3.3 (trunk 175919)
Target: x86_64-apple-darwin12.2.1
Thread model: posix

>
> John.
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list