================
@@ -105,6 +105,45 @@ std::string lifetime_modeling::getRegionName(const
MemRegion *Reg) {
return "the region";
}
+// FIXME: Retrieving the MemRegions of nested struct fields is not yet
+// supported.
+SmallVector<const MemRegion *, 4>
+lifetime_modeling::getRegionsFromAggrVal(SVal Val, CheckerContext &C) {
+ SmallVector<const MemRegion *, 4> Reg;
+
+ if (auto LCV = Val.getAs<nonloc::LazyCompoundVal>()) {
+ const TypedValueRegion *LCVRegion = LCV->getRegion();
+ QualType T = LCVRegion->getValueType();
+ MemRegionManager &MemMgr = C.getSValBuilder().getRegionManager();
+ StoreManager &StoreMgr = C.getState()->getStateManager().getStoreManager();
+
+ if (const RecordType *RT = T->getAsStructureType()) {
+ const RecordDecl *RD = RT->getDecl()->getDefinition();
+ if (!RD)
+ return Reg;
+
+ for (const auto *I : RD->fields()) {
+ // Unnamed bitfields in a struct are not relevant for the analysis
+ // so the checker should skip them and jsut continue.
----------------
benedekaibas wrote:
Applied changes:
[62d4f3c](https://github.com/llvm/llvm-project/pull/214823/commits/62d4f3ce17203c28ffff3357483a9b2883325ffb)
https://github.com/llvm/llvm-project/pull/214589
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits