r175326 - Rework the visibility computation algorithm in preparation
Rafael EspĂndola
rafael.espindola at gmail.com
Tue Feb 26 08:39:00 PST 2013
> 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:
The problem comes from the template using the canonical (first) decl
for the arguments. Some extra examples:
template <typename T>
struct __attribute__((visibility("default"))) barT {
static void zed() {}
};
class foo;
class __attribute__((visibility("default"))) foo;
template struct barT<foo>;
template <int* I>
struct __attribute__((visibility("default"))) barI {
static void zed() {}
};
extern int I;
extern int I __attribute__((visibility("default")));
template struct barI<&I>;
typedef void (*fType)(void);
template<fType F>
struct __attribute__((visibility("default"))) barF {
static void zed() {}
};
void F();
void F() __attribute__((visibility("default")));;
template struct barF<F>;
This is somewhat easy to hack in the visibility computation (see
attached patch), but what should we do for cases like:
template <typename T>
struct __attribute__((visibility("default"))) barT {
static void zed() {}
};
class foo;
template struct barT<foo>;
class __attribute__((visibility("default"))) foo;
With this patch we print a hidden visibility. But for
emplate <int* I>
struct __attribute__((visibility("default"))) barI {
static void zed() {}
};
extern int I;
void use() {
barI<&I>::zed();
}
extern int I __attribute__((visibility("default")));
We produce a default one unless the last line is commented. Should the
template instantiation point to the last decl available when it is
created?
Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 4961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130226/40cb5648/attachment.obj>
More information about the cfe-commits
mailing list