summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/visibility.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix pr18174.Rafael Espindola2013-12-081-0/+14
| | | | | | | | | | | | | | | Clang outputs LLVM one top level decl at a time. This combined with the visibility computation code looking for the newest NamespaceDecl would cause it to produce different results for nested namespaces. The two options for producing consistent results are * Delay codegen of anything inside a namespace until the end of the file. * Don't look for the newest NamespaceDecl. This patch implements the second option. This matches the gcc behavior too. llvm-svn: 196712
* CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin2013-08-151-113/+113
| | | | | | tests fail. llvm-svn: 188447
* Compute the visibility of static local variables consistently. Fixes PR16208.Eli Friedman2013-06-171-0/+18
| | | | llvm-svn: 184137
* Don't cache the visibility of types.Rafael Espindola2013-02-271-0/+17
| | | | | | | | | | | | | Since r175326 an implicitly hidden template argument can cause a template installation to become hidden, even if the template itself has an explicit default visibility. This requires that we keep track of "late" additions of the visibility attribute. This is hopefully the last followup change. It just removes the caching of visibilities from types so that we can see new attributes even after a type has been used. llvm-svn: 176164
* Use existing macros to simplify the test a bit.Rafael Espindola2013-02-261-19/+19
| | | | llvm-svn: 176138
* Use the most recent decl in getExplicitVisibility.Rafael Espindola2013-02-261-0/+33
| | | | | | | | | | | | | | | | | | | Now that implicitly hidden template arguments can make an instantiation hidden, it is important to look at more than just the canonical decl of the argument in order to see if an attribute is available in a more recent decl. This has the disadvantage of exposing when getExplicitVisibility is called, but lets us handle cases like template <typename T> struct __attribute__((visibility("default"))) barT { static void zed() {} }; class foo; class __attribute__((visibility("default"))) foo; template struct barT<foo>; llvm-svn: 176112
* Ignore visibility from enclosing template argumentsJohn McCall2013-02-211-0/+45
| | | | | | for explicit member specializations. llvm-svn: 175827
* Add a new 'type_visibility' attribute to allow users toJohn McCall2013-02-201-0/+12
| | | | | | | | | | | | | | control the visibility of a type for the purposes of RTTI and template argument restrictions independently of how visibility propagates to its non-type member declarations. Also fix r175326 to not ignore template argument visibility on a template explicit instantiation when a member has an explicit attribute but the instantiation does not. The type_visibility work is rdar://11880378 llvm-svn: 175587
* Rework the visibility computation algorithm in preparationJohn McCall2013-02-161-15/+29
| | | | | | | | | | | | | | | | for distinguishing type vs. value visibility. The changes to the visibility of explicit specializations are intentional. The change to the "ugly" test case is a consequence of a sensible implementation, and I am happy to argue that this is better behavior. Other changes may or may not be intended; it is quite difficult to divine intent from some of the code I altered. I've left behind a comment which I hope explains the philosophy behind visibility computation. llvm-svn: 175326
* Disable caching of visibility.Rafael Espindola2013-01-121-0/+44
| | | | | | | | | | | | | | The testcase in pr14929 shows that this is extremely hard to do. If we choose to apply the attribute, that causes the visibility of some decls to change and that can happen really late (during codegen). Current gcc warns and ignores the attribute in this testcase with a warning. This suggest that the correct solution is to find a point in the compilation where we can compute the visibility and * assert it was never computed before * reject any attempts to compute it again in the future (with warnings). llvm-svn: 172305
* Consider the visibility of template template arguments. GCC doesn't, but it alsoRafael Espindola2012-07-311-0/+18
| | | | | | fails to consider the linkage, which we were already considering. llvm-svn: 161070
* Add a missing testcase for merging the visibility of two declarations usedRafael Espindola2012-07-281-0/+17
| | | | | | as arguments of a template. llvm-svn: 160911
* Record visibility pragmas when we see a tag declaration. We might use itRafael Espindola2012-07-171-0/+16
| | | | | | to build a type before seeing the definition. llvm-svn: 160339
* Apply visibility pragmas to class template declarations. This is needed becauseRafael Espindola2012-07-131-0/+17
| | | | | | we might use the declaration to build a type before seeing the definition. llvm-svn: 160176
* Fix a bug in my previous commit. The problem is not that we were not using theRafael Espindola2012-07-131-0/+13
| | | | | | | canonical decl for the template, but that we were not merging attributes for templates at all! llvm-svn: 160157
* Use the canonical template decl when trying to find if it has a visibilityRafael Espindola2012-07-121-0/+13
| | | | | | attribute. llvm-svn: 160139
* Process #pragma visibility early in the parsing of class definitions. FixesRafael Espindola2012-07-121-0/+17
| | | | | | pr13338. llvm-svn: 160105
* Handle #pragma visibility in explicit specializations and enums.Rafael Espindola2012-07-111-0/+14
| | | | llvm-svn: 160057
* Don't process #pragma visibility during instantiation. The visibility of theRafael Espindola2012-07-111-0/+13
| | | | | | | instantiation depends on the template, its arguments and parameters, but not where it is instantiated. llvm-svn: 160034
* We were computing the visibility and linkage of template parameters, butRafael Espindola2012-06-111-2/+95
| | | | | | | | | only using the linkage. Use and test both, documenting that considering the visibility and linkage of template parameters is a difference from gcc. llvm-svn: 158309
* Don't ignore linkage when ignoring visibility in the instantiation of aRafael Espindola2012-05-251-0/+17
| | | | | | method template. llvm-svn: 157486
* Don't ignore linkage when ignoring visibility in the instantiation of aRafael Espindola2012-05-251-0/+15
| | | | | | function template. llvm-svn: 157480
* Consider the linkage for member class templates even when we have to ignoreRafael Espindola2012-05-251-0/+17
| | | | | | the visibility. llvm-svn: 157475
* When ignoring visibility in an instantiation, still consider the linkage.Rafael Espindola2012-05-251-0/+14
| | | | | | | Similar fixes for function and member template to follow as I write the testcases. llvm-svn: 157470
* Function template version of the previous patch.Rafael Espindola2012-05-211-0/+13
| | | | llvm-svn: 157207
* Produce a hidden symbol for zed inRafael Espindola2012-05-211-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct HIDDEN foo { }; template <class P> struct bar { }; template <> struct HIDDEN bar<foo> { DEFAULT static void zed(); }; void bar<foo>::zed() { } Before we would produce a hidden symbol in struct HIDDEN foo { }; template <class P> struct bar { }; template <> struct bar<foo> { DEFAULT static void zed(); }; void bar<foo>::zed() { } But adding HIDDEN to the specialization would cause us to produce a default symbol. llvm-svn: 157206
* Test and document a difference from gcc in the handling of visibilityRafael Espindola2012-05-211-0/+13
| | | | | | attributes. llvm-svn: 157186
* Fix the visibility of instantiations of static data members.Rafael Espindola2012-05-161-0/+12
| | | | | | Fixes pr12835. llvm-svn: 156897
* Fix our handling of visibility in explicit template instantiations.Rafael Espindola2012-05-151-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | * Don't copy the visibility attribute during instantiations. We have to be able to distinguish struct HIDDEN foo {}; template<class T> DEFAULT void bar() {} template DEFAULT void bar<foo>(); from struct HIDDEN foo {}; template<class T> DEFAULT void bar() {} template void bar<foo>(); * If an instantiation has an attribute, it takes precedence over an attribute in the template. * With instantiation attributes handled with the above logic, we can now select the minimum visibility when looking at template arguments. llvm-svn: 156821
* Fix visibility when we have two types with explicit visibility in a templateRafael Espindola2012-04-231-0/+12
| | | | | | argument list. llvm-svn: 155368
* Add another testcase that was not being covered.Rafael Espindola2012-04-231-0/+18
| | | | llvm-svn: 155351
* Add a testcase that we already get right but was not being tested. FoundRafael Espindola2012-04-221-0/+10
| | | | | | | by a chrome build on OS X. Thanks to Nico Weber for testing a patch and providing the .ii file. llvm-svn: 155326
* Cleanup testcase.Rafael Espindola2012-04-221-3/+2
| | | | llvm-svn: 155317
* An attribute in a explicit template installation should take precedence overRafael Espindola2012-04-221-0/+13
| | | | | | | | | | | the tempale arguments in deciding the visibility. This agrees with gcc 4.7. Found by trying to build chrome with component=shared_library with 155314 reverted. llvm-svn: 155316
* Revert 155102 but add a fixme while I debug what is wrong with chrome'sRafael Espindola2012-04-221-2/+6
| | | | | | components build. llvm-svn: 155314
* Add another missing testcase.Rafael Espindola2012-04-221-0/+12
| | | | llvm-svn: 155304
* Add a testcase we were already getting right, but were not testing for.Rafael Espindola2012-04-221-0/+13
| | | | llvm-svn: 155302
* Fix handling of template parameters. Found by inspection. GCC 4.7 agreesRafael Espindola2012-04-221-0/+14
| | | | | | with this testcase. llvm-svn: 155301
* In mergeVisibility, if we already have an explicit visibility, keep it.Rafael Espindola2012-04-191-0/+12
| | | | | | | | This fixes the included testcase and lets us simplify the code a bit. It does require using mergeWithMin when merging class information to its members. Expand the comments to explain why that works. llvm-svn: 155103
* In mergeVisibilityWithMin, let an implicit hidden symbol take precedence overRafael Espindola2012-04-191-2/+2
| | | | | | | | | | | | | | | | an explicit default one. This means that with -fvisibility hidden we now produce a hidden symbol for template <typename T> class DEFAULT foo { void bar() {} }; class zed {}; template class foo<zed>; This matches the behaviour of gcc 4.7. llvm-svn: 155102
* Revert r154749 for now at John McCall's request.Rafael Espindola2012-04-161-12/+0
| | | | llvm-svn: 154846
* Consider visibility attributes last, so that they take precedence.Rafael Espindola2012-04-141-0/+12
| | | | | | I am working on a cleaner fix, but this gets the case in PR12552 passing. llvm-svn: 154749
* The type of a definition should not increase its visibility. Fixes PR12221.Rafael Espindola2012-03-101-0/+8
| | | | llvm-svn: 152493
* Two fixes to how we compute visibility:Rafael Espindola2012-02-231-0/+97
| | | | | | | | | | | | * Handle some situations where we should never make a decl more visible, even when merging in an explicit visibility. * Handle attributes in members of classes that are explicitly specialized. Thanks Nico for the report and testing, Eric for the initial review, and dgregor for the awesome test27 :-) llvm-svn: 151236
* Remember if a type has its visibility set explicitly or implicitly.Rafael Espindola2012-01-141-5/+24
| | | | | | | | With that, centralize the way we merge visibility, always preferring explicit over implicit and then picking the most restrictive one. Fixes pr10113 and pr11690. llvm-svn: 148163
* Process attributes in explicit function template instantiations. Fixes part ofRafael Espindola2012-01-041-0/+5
| | | | | | PR11690. llvm-svn: 147523
* Process attributes in explicit template instatiation definitions. Fixes PR11690.Rafael Espindola2012-01-031-0/+10
| | | | llvm-svn: 147441
* Small cosmetic cleanups in code I will change anyway.Rafael Espindola2012-01-021-1/+1
| | | | llvm-svn: 147424
* Consider visibility attributes in namespaces as being explicit. I.e., theyRafael Espindola2012-01-011-0/+12
| | | | | | take precedence over command line options. Fixes PR10113. llvm-svn: 147405
* Remove a non-gcc-compatible extension that would apply attributes on ↵Eli Friedman2011-12-171-1/+1
| | | | | | declarations without a declarator to structs. Add a warning for ignored attributes. Patch by Michael Han. llvm-svn: 146796
OpenPOWER on IntegriCloud