[clang] [clang] Document the type_visibility attribute (PR #79157)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 23 07:54:16 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
I was looking for the documentation of that attribute, and the best I could find was a Stackoverflow answer or the commit message that originally introduced the attribute. I figured I might as well document what I find to save everyone time in the future.
---
Full diff: https://github.com/llvm/llvm-project/pull/79157.diff
2 Files Affected:
- (modified) clang/include/clang/Basic/Attr.td (+2-2)
- (modified) clang/include/clang/Basic/AttrDocs.td (+15)
``````````diff
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index 58838b01b4fd7ca..e47107d8edcb378 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -3220,8 +3220,8 @@ def TypeVisibility : InheritableAttr {
let Args = [EnumArgument<"Visibility", "VisibilityType",
["default", "hidden", "internal", "protected"],
["Default", "Hidden", "Hidden", "Protected"]>];
-// let Subjects = [Tag, ObjCInterface, Namespace];
- let Documentation = [Undocumented];
+ let Subjects = SubjectList<[Tag, ObjCInterface, Namespace], ErrorDiag>;
+ let Documentation = [TypeVisibilityDocs];
}
def VecReturn : InheritableAttr {
diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td
index 7e633f8e2635a9a..703f7cd314b727c 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5557,6 +5557,21 @@ See :doc:`LTOVisibility`.
}];
}
+def TypeVisibilityDocs : Documentation {
+ let Category = DocCatType;
+ let Content = [{
+The ``type_visibility`` attribute allows the ELF visibility of a type and its vague
+linkage objects (vtable, typeinfo, typeinfo name) to be controlled separately from
+the visibility of functions and data members of the type.
+
+For example, this can be used to give default visibility to the typeinfo and the vtable
+of a type while still keeping hidden visibility on its member functions and static data
+members.
+
+This attribute can only be applied to types and namespaces.
+ }]
+}
+
def RenderScriptKernelAttributeDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
``````````
</details>
https://github.com/llvm/llvm-project/pull/79157
More information about the cfe-commits
mailing list