[LLVMbugs] [Bug 12001] New: Visibility attribute ignored on a type that's used in a function prototype earlier

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 14 08:57:28 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=12001

             Bug #: 12001
           Summary: Visibility attribute ignored on a type that's used in
                    a function prototype earlier
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$ cat repro-weak-private-external.ii

template <typename BoundArgsType>
struct BindState;

template <typename P1>
struct BindState<void(P1)> {
};

template <typename P1>
void Bind(const P1& p1) {
  BindState<void(P1)>();
}

class Version;
void CheckPnaclComponentManifest(Version* version_out);  // With this line:
private. Without: not.

class __attribute__((visibility("default"))) Version { };

void f() {
  Bind(Version());
}


$ Release+Asserts/bin/clang -c repro-weak-private-external.ii
-fvisibility=hidden  && nm -m repro-weak-private-external.o | grep
__Z4BindI7VersionEvRKT_
0000000000000020 (__TEXT,__textcoal_nt) weak private external
__Z4BindI7VersionEvRKT_
0000000000000070 (__TEXT,__eh_frame) weak private external
__Z4BindI7VersionEvRKT_.eh


Note that the symbol is "weak private external. If the
CheckPnaclComponentManifest() line is removed however, it beomces "weak
external".

This is (I think) because the CheckPnacl... function decl calls
computeCachedProperties() in Type.cpp for the function type, which calls
computeCachedProperties() or the argument type. When f() is being compiled, it
then uses the cached value, which doesn't know about the explicit visibility
yet.

(This prevents the chromium component build from working on mac, see
http://crbug.com/113934)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list