[clang] [Clang] Clarify the `[[trivial_abi]]` documentation. (PR #143243)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 7 01:26:45 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Corentin Jabot (cor3ntin)
<details>
<summary>Changes</summary>
Fixes #<!-- -->36667
---
Full diff: https://github.com/llvm/llvm-project/pull/143243.diff
1 Files Affected:
- (modified) clang/include/clang/Basic/AttrDocs.td (+5-1)
``````````diff
diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td
index 40b9f8142bb69..19d5a76246bf0 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -4431,7 +4431,11 @@ destroy the object before returning. The lifetime of the copy of the parameter
in the caller ends without a destructor call when the call begins.
If a type is trivial for the purpose of calls, it is assumed to be trivially
-relocatable for the purpose of ``__is_trivially_relocatable``.
+relocatable for the purpose of ``__is_trivially_relocatable`` and
+``__builtin_is_cpp_trivially_relocatable``.
+The copy constructor of a an object of such type might not be called
+when the object is passed to a function. Therefore, the ``trivial_abi``
+attribute should not be applied to objects that contain pointer to themselves.
Attribute ``trivial_abi`` has no effect in the following cases:
``````````
</details>
https://github.com/llvm/llvm-project/pull/143243
More information about the cfe-commits
mailing list