Commit Graph

22 Commits

Author SHA1 Message Date
John McCall b8c604abfd Don't factor in visibility for templates and template arguments
for explicit specializations with their own explicit visibility.

llvm-svn: 133958
2011-06-27 23:06:04 +00:00
John McCall 8bc6d5b919 Don't consider visibility from template parameter lists if we're
computing for a nested decl with explicit visibility.  This is all part
of the general philosophy of explicit visibility attributes, where
any information that was obviously available at the attribute site
should probably be ignored.  Fixes PR9371.

llvm-svn: 126992
2011-03-04 10:39:25 +00:00
Anders Carlsson 571e2ad042 Mark VTables and RTTI data linkonce_odr instead of weak_odr, with the exception of explicit template instantiations, which have to be weak_odr.
This fixes PR6996.

llvm-svn: 124089
2011-01-24 00:46:19 +00:00
Rafael Espindola facb7d0ade Also set unnamed_addr on declarations.
llvm-svn: 123531
2011-01-15 08:23:14 +00:00
Rafael Espindola d09776b945 Only add unnamed_addr to definitions.
llvm-svn: 123354
2011-01-13 01:12:55 +00:00
Rafael Espindola bb7f7686c5 Set unnamed_addr in VTTs.
llvm-svn: 123280
2011-01-11 22:29:55 +00:00
Rafael Espindola 5674c644cf Add unnamed_addr to vtables.
llvm-svn: 123272
2011-01-11 21:10:26 +00:00
John McCall ec00cd9713 Fix test. I added one last test and then forget to re-check.
llvm-svn: 122137
2010-12-18 03:52:04 +00:00
John McCall 659a337c74 Apply attributes to explicit specializations. Specializations which
don't provide their own explicit visibility attributes should get them
from the template.  Fixes rdar://problem/8778497.

llvm-svn: 122136
2010-12-18 03:30:47 +00:00
John McCall 8e7cb6dcfa Ensure that static local variables in function templates inherit the
visibility of their function.

llvm-svn: 118065
2010-11-02 21:04:24 +00:00
John McCall 07072664c4 Ignore attributes on classes when calculating visibility for members
with their own explicit visibility attributes.  Basically we only want to
apply a single visibility attribute from any particular ancestry.

llvm-svn: 117998
2010-11-02 01:45:15 +00:00
John McCall c273f24196 Better solution: calculate the visibility of functions and variables
independently of whether they're definitions, then teach IR generation to
ignore non-explicit visibility when emitting declarations.  Use this to
make sure that RTTI, vtables, and VTTs get the right visibility.

More of rdar://problem/8613093

llvm-svn: 117781
2010-10-30 11:50:40 +00:00
John McCall 36cd5cc150 GCC faithfully calculates visibility for variables independently of
whether it's a declaration or not, then ignores that information for
declarations unless it was explicitly given.  It's not totally clear
how that should be mapped into a sane system, but make an effort.

llvm-svn: 117780
2010-10-30 09:18:49 +00:00
John McCall 37bb6c9832 Restore r117644, this time properly ignoring -fvisibility and type visibility
for namespace-scope variable declarations.

Apply visibility in IR gen to variables that are merely declared
and never defined.  We were previously emitting these with default
visibility unless they were declared with private_extern.

Ignore global visibility settings when computing visibility for
a declaration's context, and key several conditions on whether a
visibility attribute exists anywhere in the hierarchy as opposed
to whether it exists at the current level.

llvm-svn: 117729
2010-10-29 22:22:43 +00:00
Daniel Dunbar df8792128f Revert r117644, "Apply visibility in IR gen to variables that are merely
declared", it breaks things.

llvm-svn: 117653
2010-10-29 15:19:36 +00:00
John McCall 4af6bf1fdc Apply visibility in IR gen to variables that are merely declared
and never defined.  We were previously emitting these with default
visibility unless they were declared with private_extern.

Ignore global visibility settings when computing visibility for
a declaration's context, and key several conditions on whether a
visibility attribute exists anywhere in the hierarchy as opposed
to whether it exists at the current level.

llvm-svn: 117644
2010-10-29 07:49:41 +00:00
John McCall 033caa5895 When computing the visibility of a class member, calculate the visibility
of its context without considering global settings like -fvisibility=hidden.
Fixes PR8492.

llvm-svn: 117628
2010-10-29 00:29:13 +00:00
John McCall 2efaf11695 Abandon the type-visibility optimization for functions. GCC doesn't do it,
and it's too much trouble to push for.  Fixes PR8478.

llvm-svn: 117532
2010-10-28 07:07:52 +00:00
John McCall 5fe84129e2 A couple of tweaks to the visibility rules:
- tags with C linkage should ignore visibility=hidden
  - functions and variables with explicit visibility attributes should
    ignore the linkage of their types
Either of these should be sufficient to fix PR8457.

Also, FileCheck-ize a test case.

llvm-svn: 117351
2010-10-26 04:59:26 +00:00
John McCall 457a04e3ce Substantially revise how clang computes the visibility of a declaration to
more closely parallel the computation of linkage.  This gets us to a state
much closer to what gcc emits, modulo bugs, which will undoubtedly arise in
abundance.

llvm-svn: 117147
2010-10-22 21:05:15 +00:00
Douglas Gregor 4f6e8deec4 Make sure to set the visible on a vtable; VTTs and typeinfo already
handle visibility properly. Fixes <rdar://problem/8091955>. 

llvm-svn: 105977
2010-06-14 23:41:45 +00:00
Anders Carlsson 10d369d1a2 Improved handling of the visibility attribute. Declarations now inherit their parent's visibility.
(This is kind of a risky change, but I did a self-host build and everything appears to work fine!)

llvm-svn: 95511
2010-02-07 01:44:36 +00:00