================ @@ -1353,6 +1353,49 @@ static void showBRDefaultDiagnostics(llvm::raw_svector_ostream &OS, OS << " to "; SI.Dest->printPretty(OS); } + + // If the value was part of a loop widening node and its value was + // invalidated (i.e. replaced with a conjured symbol) then let the user know + // that it was due to loop widening. + if (SI.StoreSite && SI.Dest && + SI.StoreSite->getLocation().getTag() == + ExprEngine::loopWideningNodeTag()) { + + // TODO: Is it always the case that there's only one predecessor? + assert(SI.StoreSite->hasSinglePred() && + "more than one predecessor found, this needs to be handled..."); + if (const ExplodedNode *previous = SI.StoreSite->getFirstPred()) { + // Was the associated memory region for this variable changed from + // non-Symbolic to Symbolic because of invalidation? + // TODO: Better yet, if there was simply a way to know if a given + // SVal / MemRegion was invalidated as part of the current state, + // then that should be more robust than what's going on here. + // Could we somehow make use of "RegionChanges" / + // "runCheckersForRegionChanges" and the ExplicitRegions parameter. + // Still need to somehow know when a particular Global + // Variable is invalidated. I have not found this to be possible with + // "RegionChanges" unless I'm missing something... ---------------- dgg5503 wrote:
I tried to implement this in https://github.com/llvm/llvm-project/compare/main...dgg5503:llvm-project:dgg5503/main/invalidation-diagnostic-b but all `MemRegion`s from the `ProgramState` and before are tracked. I'm wondering if there's a way to clear `InvalidatedMemoryRegionSet` at the start of each `ProgramState`, or, if there's a different approach I should be taking... https://github.com/llvm/llvm-project/pull/122398 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits