[cfe-commits] [PR10113][patch] Don't consider template arguments when the visibility is already explicit

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Sun Jan 1 18:21:42 PST 2012


> + void mergeVisibility(Visibility V) {
> + mergeVisibility(V, visibilityExplicit());
> 
> This is the same as 'mergeVisibility(V, false)', why not just make E
> have a default argument of false?

Good idea. Updated patch attached.

> if (Var->getStorageClass() == SC_PrivateExtern)
> @@ -602,12 +601,9 @@ static LinkageInfo getLVForClassMember(const
> NamedDecl *D, LVFlags F) {
> LVPair TypeLV = VD->getType()->getLinkageAndVisibility();
> if (TypeLV.first != ExternalLinkage)
> LV.mergeLinkage(UniqueExternalLinkage);
> - if (!LV.visibilityExplicit())
> - LV.mergeVisibility(TypeLV.second);
> + LV.mergeVisibility(TypeLV.second);
> }
> 
> - F.ConsiderGlobalVisibility &= !LV.visibilityExplicit();
> 
> I don't entirely understand this change, but I'm not deeply familiar
> with the code. I'd just like someone who is to ensure this is correct. I
> assume this is tested by your changes to the codegen.cpp test?

It just became dead code with the new mergeVisibility function. If
LV.visibilityExplicit() is true, F.ConsiderGlobalVisibility would become
false, but that is the case where the new mergeVisibility does nothing.

Cheers,
Rafael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr10113.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120101/4f534ce5/attachment.ksh>


More information about the cfe-commits mailing list