r285292 - Add documentation for the transparent_union attribute
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 27 06:51:31 PDT 2016
Author: arphaman
Date: Thu Oct 27 08:51:30 2016
New Revision: 285292
URL: http://llvm.org/viewvc/llvm-project?rev=285292&view=rev
Log:
Add documentation for the transparent_union attribute
Differential Revision: https://reviews.llvm.org/D25995
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=285292&r1=285291&r2=285292&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Thu Oct 27 08:51:30 2016
@@ -1542,7 +1542,7 @@ def Target : InheritableAttr {
def TransparentUnion : InheritableAttr {
let Spellings = [GCC<"transparent_union">];
// let Subjects = SubjectList<[Record, TypedefName]>;
- let Documentation = [Undocumented];
+ let Documentation = [TransparentUnionDocs];
let LangOpts = [COnly];
}
Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=285292&r1=285291&r2=285292&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Thu Oct 27 08:51:30 2016
@@ -2649,3 +2649,21 @@ Conversely, ``__attribute__((xray_never_
If a function has neither of these attributes, they become subject to the XRay heuristics used to determine whether a function should be instrumented or otherwise.
}];
}
+
+def TransparentUnionDocs : Documentation {
+ let Category = DocCatType;
+ let Content = [{
+This attribute can be applied to a union to change the behaviour of calls to
+functions that have an argument with a transparent union type. The compiler
+behaviour is changed in the following manner:
+
+- A value whose type is any member of the transparent union can be passed as an
+argument without the need to cast that value.
+
+- The argument is passed to the function using the calling convention of the
+first member of the transparent union. Consequently, all the members of the
+transparent union should have the same calling convention as its first member.
+
+Transparent unions are not supported in C++.
+ }];
+}
More information about the cfe-commits
mailing list