[clang] [Clang SA]: add support for mismatched ownership_returns+ownership_takes calls for custom allocation classes (PR #98941)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 17 11:25:34 PDT 2024
================
@@ -103,14 +103,49 @@ using namespace std::placeholders;
namespace {
// Used to check correspondence between allocators and deallocators.
-enum AllocationFamily {
+enum AllocationFamilyKind {
AF_None,
AF_Malloc,
AF_CXXNew,
AF_CXXNewArray,
AF_IfNameIndex,
AF_Alloca,
- AF_InnerBuffer
+ AF_InnerBuffer,
+ AF_Custom,
+};
+
+struct AllocationFamily {
+ AllocationFamilyKind Kind;
+ std::optional<StringRef> CustomName;
+
+ explicit AllocationFamily(AllocationFamilyKind kind,
+ std::optional<StringRef> name = std::nullopt)
----------------
steakhal wrote:
Please use upper camel case for variable names. Shadowing is not a problem for constructor parameters and init-lists, and within the ctor body the semantics are anyways well-defined.
https://github.com/llvm/llvm-project/pull/98941
More information about the cfe-commits
mailing list