[AST] correct the behavior of -fvisibility-inlines-hidden option (don't make static...
authorHiroshi Inoue <inouehrs@jp.ibm.com>
Wed, 22 Aug 2018 05:43:27 +0000 (05:43 +0000)
committerHiroshi Inoue <inouehrs@jp.ibm.com>
Wed, 22 Aug 2018 05:43:27 +0000 (05:43 +0000)
commit03ff37ddabeb066d5f7915b3cfb89612c7fdb7eb
tree2a05d2322b4f656b7ac16f4b4283fbd345cbf9c2
parent934e9a3976db9d3535c9443e8dbbf96eca06c9a7
[AST] correct the behavior of -fvisibility-inlines-hidden option (don't make static local variables hidden)

The command line option -fvisibility-inlines-hidden makes inlined method hidden, but it is expected not to affect the visibility of static local variables in the function.
However, Clang makes the static local variables in the function also hidden as reported in PR37595. This problem causes LLVM bootstarp failure on Fedora 28 if configured with -DBUILD_SHARED_LIBS=ON.

This patch makes the behavior of -fvisibility-inlines-hidden option to be consistent with that of gcc; the option does not change the visibility of the static local variables if the containing function does not associated with explicit visibility attribute and becomes hidden due to this option.

Differential Revision: https://reviews.llvm.org/D50968

llvm-svn: 340386
clang/lib/AST/Decl.cpp
clang/test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp [new file with mode: 0644]