[clang] [analyzer] Fix uninitialized base class with initializer list when ctor is not declared in the base class (#70464) (PR #70792)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 06:21:20 PDT 2023


================
@@ -1222,6 +1222,15 @@ void ExprEngine::ProcessInitializer(const CFGInitializer CFGInit,
       PostInitializer PP(BMI, FieldLoc.getAsRegion(), stackFrame);
       evalBind(Tmp, Init, Pred, FieldLoc, InitVal, /*isInit=*/true, &PP);
     }
+  } else if (BMI->isBaseInitializer() && isa<InitListExpr>(Init)) {
+    // When the base class is initialized with an initialization list, there
+    // will not be a CXXConstructExpr to initialize the base region. Hence, we
+    // need to make the bind for it.
+    StoreManager &StoreMgr = State->getStateManager().getStoreManager();
+    SVal BaseLoc = StoreMgr.evalDerivedToBase(
----------------
steakhal wrote:

```suggestion
    SVal BaseLoc = getStoreManager()->evalDerivedToBase(
```

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


More information about the cfe-commits mailing list