grace/lilac

An Experimental C Library using modern features

git clone https://git.gae.moe/grace/lilac

Grace Yoderinitf3dea09

main
618 B18 linesraw
1#ifndef _LILAC_MEM_H_
2#define _LILAC_MEM_H_
3
4
5// This is for clang borrow checking rules
6// https://clang.llvm.org/docs/AttributeReference.html#ownership-holds-ownership-returns-ownership-takes-clang-static-analyzer
7
8/// Creates the object with the specified allocator
9// hopefully this is valid there are no tests yet
10#define creates(allocator) [[clang::ownership_returns(allocator) allocating]]
11
12/// Takes ownership of the object
13#define holds(allocator, idx) [[clang::ownership_takes(allocator, idx)]]
14
15/// Frees the Memory of the object
16#define destroys(allocator) [[clang::ownership_takes(allocator, 1)]]
17
18#endif