Author: Corentin Jabot
Date: 2025-06-09T17:32:48+02:00
New Revision: 9c52b3c52eb760a52826aad1368a4b0b46d924d3

URL: 
https://github.com/llvm/llvm-project/commit/9c52b3c52eb760a52826aad1368a4b0b46d924d3
DIFF: 
https://github.com/llvm/llvm-project/commit/9c52b3c52eb760a52826aad1368a4b0b46d924d3.diff

LOG: [Clang] Clarify the `[[trivial_abi]]` documentation. (#143243)

Fixes #36667

Added: 
    

Modified: 
    clang/include/clang/Basic/AttrDocs.td

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index 0a9919fca2520..ea3c43f38d9fe 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -4433,7 +4433,14 @@ 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``.
+When a type marked with ``[[trivial_abi]]`` is used as a function argument,
+the compiler may omit the call to the copy constructor.
+Thus, side effects of the copy constructor are potentially not performed.
+For example, objects that contain pointers to themselves or otherwise depend
+on their address (or the address or their subobjects) should not be declared
+``[[trivial_abi]]``.
 
 Attribute ``trivial_abi`` has no effect in the following cases:
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to