[PATCH] D50968: [AST] make a static local variable in a fuction hidden by -fvisibility-inlines-hidden visible

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 21 12:47:42 PDT 2018


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

It would also be nice if we handled this, but you might consider it out of scope:

  inline int __attribute__((visibility("default"))) intentionally_hidden() {
    static int __attribute__((visibility("hidden"))) var;
    return ++var;
  }



================
Comment at: lib/AST/Decl.cpp:1275
+
     LV = getLVForDecl(FD, computation);
   }
----------------
inouehrs wrote:
> inouehrs wrote:
> > rnk wrote:
> > > I think the right way to do this is to compute the linkage & visibility of FD, as is done here, check if the visibility is explicit, and if not, under the same conditions that you have above, upgrade the visibility to default.
> > I agree. I will try to fix this. Thanks.
> I cannot use `LV.isVisibilityExplicit()` for this check because the hidden visibility by -fvisibility-inlines-hidden is considered as explicit. I use `getExplicitVisibility` instead.
Sounds good.


https://reviews.llvm.org/D50968





More information about the llvm-commits mailing list