[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-09-01 Thread via cfe-commits
https://github.com/vidur2 closed https://github.com/llvm/llvm-project/pull/155131 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-09-01 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > So is it best to close this PR? Yes, I think this PR should be closed (because although it is a good approach for fixing the bug, we have that other commit which is further along the same path). https://github.com/llvm/llvm-project/pull/155131 __

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-30 Thread via cfe-commits
vidur2 wrote: So is it best to close this PR? https://github.com/llvm/llvm-project/pull/155131 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-29 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > Based on your review of the code do you have any suggestions on how I should > go about tightening the heuristic? Your code puts pointers (that were allocated by `new` or `new[]`) into a relinquished state when they are passed to a constructor call. Currently this is overly

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-28 Thread via cfe-commits
vidur2 wrote: Thanks! Based on your review of the code do you have any suggestions on how I should go about tightening the heuristic? https://github.com/llvm/llvm-project/pull/155131 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-27 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions cpp -- clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-27 Thread via cfe-commits
vidur2 wrote: > > Im sorry about messing up the naming convention, I havent contributed too > > much to open source stuff. > > No harm done, this is part of the plan 🙂 Every contributor must learn these > sometime and this time it was your turn to do so. > > I read the suggested code changes

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-27 Thread Donát Nagy via cfe-commits
@@ -3074,6 +3077,43 @@ void MallocChecker::checkPostCall(const CallEvent &Call, (*PostFN)(this, C.getState(), Call, C); return; } + + ProgramStateRef State = C.getState(); + + if (const auto *Ctor = dyn_cast(&Call)) { +// Ensure we are constructing a concrete ob

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-27 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/155131 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-27 Thread Donát Nagy via cfe-commits
@@ -218,3 +239,138 @@ void caller() { (void)n; } // no-warning: No potential memory leak here, because that's been already reported. } // namespace symbol_reaper_lifetime + + +// Minimal RAII class that properly deletes its pointer. +class Bar { +public: + explicit Bar(int

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-27 Thread Donát Nagy via cfe-commits
@@ -3074,6 +3077,43 @@ void MallocChecker::checkPostCall(const CallEvent &Call, (*PostFN)(this, C.getState(), Call, C); return; } + + ProgramStateRef State = C.getState(); + + if (const auto *Ctor = dyn_cast(&Call)) { +// Ensure we are constructing a concrete ob

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-27 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: > Im sorry about messing up the naming convention, I havent contributed too > much to open source stuff. No harm done, this is part of the plan :slightly_smiling_face: Every contributor must learn these sometime and this time it was your turn to do so.

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-26 Thread via cfe-commits
https://github.com/vidur2 updated https://github.com/llvm/llvm-project/pull/155131 >From f903652135758b6a7a20d15565177304add16e2c Mon Sep 17 00:00:00 2001 From: vidur2 Date: Thu, 14 Aug 2025 17:28:36 -0400 Subject: [PATCH 1/4] initial malloc change check --- .../StaticAnalyzer/Checkers/Malloc

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-26 Thread via cfe-commits
vidur2 wrote: Ok, I made the changes https://github.com/llvm/llvm-project/pull/155131 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-26 Thread Balazs Benics via cfe-commits
@@ -14,6 +14,8 @@ #include "Inputs/system-header-simulator-for-malloc.h" +#include steakhal wrote: Yes, that should largely work. https://github.com/llvm/llvm-project/pull/155131 ___ cfe-commits mailing list cfe-

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-26 Thread via cfe-commits
@@ -14,6 +14,8 @@ #include "Inputs/system-header-simulator-for-malloc.h" +#include vidur2 wrote: Do you have any suggestions on how to do this? Should I just copy/paste the necessary functionality from utility into the file? What is standard practice? htt

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-25 Thread via cfe-commits
vidur2 wrote: Besides the regression test stuff, I should be ready for CR. Im sorry about the naming convention, I havent contributed too much to open source stuff. https://github.com/llvm/llvm-project/pull/155131 ___ cfe-commits mailing list cfe-comm

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-25 Thread via cfe-commits
https://github.com/vidur2 edited https://github.com/llvm/llvm-project/pull/155131 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits