================
@@ -3068,12 +3124,225 @@ void MallocChecker::checkDeadSymbols(SymbolReaper
&SymReaper,
C.addTransition(state->set<RegionState>(RS), N);
}
+// Helper function to check if a name is a recognized smart owning pointer name
+static bool isSmartOwningPtrName(StringRef Name) {
+ return Name == "unique_ptr" || Name == "shared_ptr";
+}
+
+// Allowlist of owning smart pointers we want to recognize.
+// Start with unique_ptr and shared_ptr. (intentionally exclude weak_ptr)
----------------
NagyDonat wrote:
```suggestion
// Allowlist of owning smart pointers we want to recognize.
// Start with unique_ptr and shared_ptr; weak_ptr is excluded intentionally
// because it does not own the pointee.
static bool isSmartOwningPtrName(StringRef Name) {
return Name == "unique_ptr" || Name == "shared_ptr";
}
// Check if a type is a smart owning pointer type.
```
I suggest moving the note about "allowlist" and excluding `weak_ptr` to
`isSmartOwningPtrName` because it is more relevant there.
https://github.com/llvm/llvm-project/pull/152751
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits