[clang] [clang][analyzer] Add support for detecting uninitialized dynamically-allocated objects (PR #193001)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 22 01:09:50 PDT 2026


guillem-bartrina-sonarsource wrote:

Thank you for your valuable comments, @NagyDonat and @steakhal

> The code change LGTM.
> 
> As the difference between static / dynamic allocation seems to be orthogonal to the other features of this checker, I find it excessive that you duplicate so many (every?) test with a dynamic allocation variant.
> 
> In general, if a software has N _clearly_ orthogonal features, then they should be covered by N independent tests instead of 2^N tests that cover every combination. Testing combinations should be reserved for the cases where (1) there is interference between them or (2) the reader would suspect that there is interference between them.

I agree that adding the dynamic version of each assignment is a bit overkill for what I’m trying to achieve, but it was the simplest way to proceed, since I didn’t want to go through thousands of individual tests to see which ones would benefit from the new case. In fact, it was precisely the failure of one of those many tests that made me realize I also had to modify `willObjectBeAnalyzedLater`. Since I don’t have time to select the minimum set of tests to which it would make sense to add the dynamic variant, I prefer to keep all the tests.

> I can accept the patch as it is if this verbosity is important for you, but I would prefer reverting some of the changes in the tests because the duplication (e.g. repeated `expected-warning` markers) is annoying for the readers of these test files.
> Is this just duplicating the report? If so, could we pin the number of occurrences instead?

I've decided to follow @NagyDonat's suggestion (9fbf7566eef51887b80972c8a6f00d336fd0a115). If you have any other concerns, let me know.

https://github.com/llvm/llvm-project/pull/193001


More information about the cfe-commits mailing list