[PATCH] D117091: [Clang] Add attributes alloc_size and alloc_align to mm_malloc

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 12 01:11:45 PST 2022


xbolva00 created this revision.
xbolva00 added reviewers: reames, rjmccall, jdoerfert.
xbolva00 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

alloc align https://clang.llvm.org/docs/AttributeReference.html#alloc-align
alloc size https://clang.llvm.org/docs/AttributeReference.html#alloc-size


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117091

Files:
  clang/lib/Headers/mm_malloc.h


Index: clang/lib/Headers/mm_malloc.h
===================================================================
--- clang/lib/Headers/mm_malloc.h
+++ clang/lib/Headers/mm_malloc.h
@@ -28,9 +28,9 @@
 
 #if !(defined(_WIN32) && defined(_mm_malloc))
 static __inline__ void *__attribute__((__always_inline__, __nodebug__,
-                                       __malloc__))
-_mm_malloc(size_t __size, size_t __align)
-{
+                                       __malloc__, alloc_size(1),
+                                       alloc_align(2)))
+_mm_malloc(size_t __size, size_t __align) {
   if (__align == 1) {
     return malloc(__size);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117091.399242.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220112/2df32cbb/attachment.bin>


More information about the cfe-commits mailing list