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

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 28 08:56:28 PDT 2026


================
@@ -451,26 +451,44 @@ static void printTail(llvm::raw_ostream &Out,
 //                           Utility functions.
 //===----------------------------------------------------------------------===//
 
+static const SubRegion *
+getConstructedSubRegion(const CXXConstructorDecl *CtorDecl,
+                        CheckerContext &Context) {
+  Loc ThisLoc =
+      Context.getSValBuilder().getCXXThis(CtorDecl, Context.getStackFrame());
+  SVal ObjectV = Context.getState()->getSVal(ThisLoc);
----------------
steakhal wrote:

aha. got it.
I wonder that is the temporary object `&temp_object` in the example - I don't see any temporaries.

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


More information about the cfe-commits mailing list