Lines Matching full:visibility
54 #include "clang/Basic/Visibility.h"
112 // Visibility rules aren't rigorously externally specified, but here
115 // 1. An explicit visibility attribute is generally a direct expression
117 // visibility attribute applies. If no visibility attribute applies,
118 // global visibility settings are considered.
121 // an explicit visibility attribute is just a default rule, and
122 // visibility can be decreased by the visibility of template
124 // explicit specialization or instantiation causes all the visibility
127 // 3. A variable that does not otherwise have explicit visibility can
128 // be restricted by the visibility of its type.
130 // 4. A visibility restriction is explicit if it comes from an
131 // attribute (or something like it), not a global visibility setting.
132 // When emitting a reference to an external symbol, visibility
135 // 5. When computing the visibility of a non-type, including a
136 // non-type member of a class, only non-type visibility restrictions
137 // are considered: the 'visibility' attribute, global value-visibility
140 // 6. When computing the visibility of a type, including a type member
141 // of a class, only type visibility restrictions are considered:
142 // the 'type_visibility' attribute and global type-visibility settings.
143 // However, a 'visibility' attribute counts as a 'type_visibility'
146 // The visibility of a "secondary" entity, like a template argument,
148 // primary entity for which we are computing visibility. For example,
149 // the visibility of a specialization of either of these templates:
152 // is restricted according to the type visibility of the argument 'T',
153 // the type visibility of 'bool(&)(T,X)', and the value visibility of
159 /// visibility settings from attributes and the like?
165 /// that records that it already has explicit visibility.
172 static std::optional<Visibility> getExplicitVisibility(const NamedDecl *D, in getExplicitVisibility()
175 "asking for explicit visibility when we shouldn't be"); in getExplicitVisibility()
180 /// visibility computation?
206 /// Given a visibility attribute, return the explicit visibility
209 static Visibility getVisibilityFromAttr(const T *attr) { in getVisibilityFromAttr()
218 llvm_unreachable("bad visibility kind"); in getVisibilityFromAttr()
221 /// Return the explicit visibility of the given declaration.
222 static std::optional<Visibility>
224 // If we're ultimately computing the visibility of a type, look for in getVisibilityOf()
225 // a 'type_visibility' attribute before looking for 'visibility'. in getVisibilityOf()
232 // If this declaration has an explicit visibility attribute, use it. in getVisibilityOf()
248 /// template parameter list. For visibility purposes, template
255 // contribute to visibility, pack or not. in getLVForTemplateParameterList()
318 /// want to honor the visibility of template arguments in the same way.
375 // Include visibility from the template parameters and arguments in shouldConsiderTemplateVisibility()
377 // with direct explicit visibility. (Implicit instantiations won't in shouldConsiderTemplateVisibility()
385 /// Merge in template-related linkage and visibility for the given
417 /// Does the given declaration have a direct visibility attribute
428 /// Should we consider visibility associated with the template
433 // Include visibility from the template parameters and arguments in shouldConsiderTemplateVisibility()
435 // with direct explicit visibility (and note that implicit in shouldConsiderTemplateVisibility()
439 // for an explicit specialization when computing the visibility of a in shouldConsiderTemplateVisibility()
440 // member thereof with explicit visibility. in shouldConsiderTemplateVisibility()
446 // explicit visibility attribute, that must directly express the in shouldConsiderTemplateVisibility()
452 // visibility restrictions. in shouldConsiderTemplateVisibility()
464 /// Merge in template-related linkage and visibility for the given
472 // visibility if we're only considering template arguments. in mergeTemplateLV()
486 // template-argument visibility if we've got an explicit in mergeTemplateLV()
487 // instantiation with a visibility attribute. in mergeTemplateLV()
495 /// Should we consider visibility associated with the template
502 // Include visibility from the template parameters and arguments in shouldConsiderTemplateVisibility()
504 // with direct explicit visibility (and note that implicit in shouldConsiderTemplateVisibility()
510 // declaration. As such, if it has an explicit visibility attribute, in shouldConsiderTemplateVisibility()
520 /// Merge in template-related linkage and visibility for the given
529 // visibility if we're only considering template arguments. in mergeTemplateLV()
537 // template-argument visibility if we've got an explicit in mergeTemplateLV()
538 // instantiation with a visibility attribute. in mergeTemplateLV()
701 if (std::optional<Visibility> Vis = getExplicitVisibility(D, computation)) { in getLVForNamespaceScopeDecl()
704 // If we're declared in a namespace with a visibility attribute, in getLVForNamespaceScopeDecl()
705 // use that namespace's visibility, and it still counts as explicit. in getLVForNamespaceScopeDecl()
711 if (std::optional<Visibility> Vis = in getLVForNamespaceScopeDecl()
719 // Add in global settings if the above didn't give us direct visibility. in getLVForNamespaceScopeDecl()
721 // Use global type/value visibility as appropriate. in getLVForNamespaceScopeDecl()
722 Visibility globalVisibility = in getLVForNamespaceScopeDecl()
728 // If we're paying attention to global visibility, apply in getLVForNamespaceScopeDecl()
729 // -finline-visibility-hidden if this is an inline method. in getLVForNamespaceScopeDecl()
787 // C99 6.2.2p4 and propagating the visibility attribute, so we don't have in getLVForNamespaceScopeDecl()
818 // merging storage classes and visibility attributes, so we don't have to in getLVForNamespaceScopeDecl()
905 // If we ended up with non-externally-visible linkage, visibility should in getLVForNamespaceScopeDecl()
924 // linkage and visibility of a template specialization, we might hit in getLVForClassMember()
937 // If we have an explicit visibility attribute, merge that in. in getLVForClassMember()
939 if (std::optional<Visibility> Vis = getExplicitVisibility(D, computation)) in getLVForClassMember()
941 // If we're paying attention to global visibility, apply in getLVForClassMember()
942 // -finline-visibility-hidden if this is an inline method. in getLVForClassMember()
945 // the class visibility. in getLVForClassMember()
950 // If this class member has an explicit visibility attribute, the only in getLVForClassMember()
951 // thing that can change its visibility is the template arguments, so in getLVForClassMember()
967 // we need to completely ignore the visibility from it. in getLVForClassMember()
1027 // type's visibility unless it's a definition. in getLVForClassMember()
1062 // an explicit attribute, ignore visibility from the parent. in getLVForClassMember()
1065 // optimization: hasDVA() is true only with explicit visibility. in getLVForClassMember()
1177 // We don't care about visibility here, so ask for the cheapest in getLinkageInternal()
1178 // possible visibility analysis. in getLinkageInternal()
1224 static std::optional<Visibility>
1231 if (std::optional<Visibility> V = getVisibilityOf(ND, kind)) in getExplicitVisibilityAux()
1235 // and the corresponding decl has explicit visibility, use that. in getExplicitVisibilityAux()
1242 // If there wasn't explicit visibility there, and this is a in getExplicitVisibilityAux()
1243 // specialization of a class template, check for visibility in getExplicitVisibilityAux()
1247 // explicit visibility attributes. in getExplicitVisibilityAux()
1281 // explicit visibility attribute, use that. in getExplicitVisibilityAux()
1288 // and the corresponding decl has explicit visibility, use that. in getExplicitVisibilityAux()
1296 // The visibility of a template is stored in the templated decl. in getExplicitVisibilityAux()
1303 std::optional<Visibility>
1311 // This lambda has its linkage/visibility determined by its owner. in getLVForClosure()
1330 // visibility of that type, because it might involve this closure type. The in getLVForClosure()
1360 if (std::optional<Visibility> Vis = in getLVForLocalDecl()
1366 // merging storage classes and visibility attributes, so we don't have to in getLVForLocalDecl()
1381 if (std::optional<Visibility> Vis = in getLVForLocalDecl()
1430 // explicit visibility on the parent class, and use that for static locals in getLVForLocalDecl()
1435 Visibility globalVisibility = in getLVForLocalDecl()
1567 /// getLVForDecl - Get the linkage and visibility for the given declaration.
1798 // name any information about its enum enclosing scope, as its visibility in printNestedNameSpecifier()
1907 // different visibility. Any attempt to use the name will result in an in declarationReplaces()