[clang] [analyzer] Handle builtin functions in MallocChecker (PR #88416)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 14 06:47:20 PDT 2024
=?utf-8?q?DonĂ¡t?= Nagy <donat.nagy at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/88416 at github.com>
================
@@ -214,3 +214,15 @@ void *realloc(void **ptr, size_t size) { realloc(ptr, size); } // no-crash
namespace pr46253_paramty2{
void *realloc(void *ptr, int size) { realloc(ptr, size); } // no-crash
} // namespace pr46253_paramty2
+
+namespace pr81597{
+struct S {};
+struct T {
+ void free(const S& s);
+};
+void f(T& t) {
+ S s;
+ // This is not the free you are looking for...
+ t.free(s); // no-warning
+}
+} // namespace pr81597
----------------
steakhal wrote:
```suggestion
namespace pr81597 {
struct S {};
struct T {
void free(const S& s);
};
void f(T& t) {
S s;
t.free(s); // no-warning: This is not the free you are looking for...
}
} // namespace pr81597
```
Indent by 2 spaces, have a space before the `{` token.
https://github.com/llvm/llvm-project/pull/88416
More information about the cfe-commits
mailing list