[clang] [clang] Document the type_visibility attribute (PR #79157)
Louis Dionne via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 23 07:53:47 PST 2024
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/79157
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.
>From c525b81664d23e3bc75fb6b795459bcbb7e305a4 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 23 Jan 2024 10:51:53 -0500
Subject: [PATCH] [clang] Document the type_visibility attribute
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.
---
clang/include/clang/Basic/Attr.td | 4 ++--
clang/include/clang/Basic/AttrDocs.td | 15 +++++++++++++++
2 files changed, 17 insertions(+), 2 deletions(-)
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 = [{
More information about the cfe-commits
mailing list