3.1 branched and so should this thread :-)

These are the proposed changes for 3.2, we can then discuss what
should be ported to 3.1. I have split the previous patch in two mostly
to make it easier to review. The first one is just a reorganization
that should be a nop with the current definition of mergeVisibility
and mergeVisibilityWithMin.  The second patch changes those functions
and remove old workarounds from Decl.cpp. With the second patch, the
visible changes are

* We give precedence to attributes in a decl, and produce a default symbol in

struct HIDDEN RECT {
  int top;
};
DEFAULT RECT data_rect = {0};

* In a similar way, the attribute in the method bar wins in both A<H>
and A<D> in the following cases:

   template <class T> struct HIDDEN A {
     static void DEFAULT bar();
   };
   struct HIDDEN H;
   struct DEFAULT D;

Currently clang produces a default symbol for A<D> and a hidden one
for A<H>. gcc 4.7 has the same problem:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52995.

Lastly, the patch also fixes mergeWithMinVisibility to be just that.
It is now only used for merging type parameters in templates, and in
this case we do want to make the type resulting from the template
instantiation hidden if any of the arguments are. For example, if
using -fvisibility=hidden we produce a hidden zed in

template<typename T>
class DEFAULT bar {
  void zed() {}
};
struct zed { };
template class bar<zed>;

In this we now agree with gcc 4.7

Cheers,
Rafael

Attachment: refactor.patch
Description: Binary data

Attachment: fixes.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to