Author: Dávid Bolvanský Date: 2021-04-24T15:27:48+02:00 New Revision: c68f92983600196e33e8abfbcd1aa19235f34c8d
URL: https://github.com/llvm/llvm-project/commit/c68f92983600196e33e8abfbcd1aa19235f34c8d DIFF: https://github.com/llvm/llvm-project/commit/c68f92983600196e33e8abfbcd1aa19235f34c8d.diff LOG: [Clang] Added doc for malloc attribute Taken mostly from LLVM langref. Added: Modified: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/AttrDocs.td Removed: ################################################################################ diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index fcad24b83a05..08534ec61620 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -1494,7 +1494,7 @@ def IFunc : Attr, TargetSpecificAttr<TargetELF> { def Restrict : InheritableAttr { let Spellings = [Declspec<"restrict">, GCC<"malloc">]; let Subjects = SubjectList<[Function]>; - let Documentation = [Undocumented]; + let Documentation = [RestrictDocs]; } def LayoutVersion : InheritableAttr, TargetSpecificAttr<TargetMicrosoftCXXABI> { diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 0af5b790d8a3..7b9d618c07ae 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -3712,6 +3712,15 @@ system) and does not imply undefined behavior, making it more widely applicable. }]; } +def RestrictDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +The ``malloc`` attribute indicates that the function acts like a system memory +allocation function, returning a pointer to allocated storage disjoint from the +storage for any other object accessible to the caller. + }]; +} + def ReturnsNonNullDocs : Documentation { let Category = NullabilityDocs; let Content = [{ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits