From 3d90e7e8db2c522c87f0fbfcdcb9aeed62680922 Mon Sep 17 00:00:00 2001 From: Artem Dergachev Date: Wed, 3 Apr 2019 18:21:16 +0000 Subject: Revert "[analyzer] Toning down invalidation a bit". This reverts commit r352473. The overall idea is great, but it seems to cause unintented consequences when not only Region Store invalidation but also pointer escape mechanism was accidentally affected. Based on discussions in https://reviews.llvm.org/D58121#1452483 and https://reviews.llvm.org/D57230#1434161 Differential Revision: https://reviews.llvm.org/D57230 llvm-svn: 357620 --- clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'clang/lib/StaticAnalyzer/Core/CallEvent.cpp') diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp index 8dc6646e0eb..11dda7c3acb 100644 --- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -303,23 +303,11 @@ ProgramStateRef CallEvent::invalidateRegions(unsigned BlockCount, for (unsigned Idx = 0, Count = getNumArgs(); Idx != Count; ++Idx) { // Mark this region for invalidation. We batch invalidate regions // below for efficiency. - if (const MemRegion *MR = getArgSVal(Idx).getAsRegion()) { - bool UseBaseRegion = true; - if (const auto *FR = MR->getAs()) { - if (const auto *TVR = FR->getSuperRegion()->getAs()) { - if (!TVR->getValueType()->isUnionType()) { - ETraits.setTrait(MR, RegionAndSymbolInvalidationTraits:: - TK_DoNotInvalidateSuperRegion); - UseBaseRegion = false; - } - } - } - // todo: factor this out + handle the lower level const pointers. - if (PreserveArgs.count(Idx)) - ETraits.setTrait( - UseBaseRegion ? MR->getBaseRegion() : MR, - RegionAndSymbolInvalidationTraits::TK_PreserveContents); - } + if (PreserveArgs.count(Idx)) + if (const MemRegion *MR = getArgSVal(Idx).getAsRegion()) + ETraits.setTrait(MR->getBaseRegion(), + RegionAndSymbolInvalidationTraits::TK_PreserveContents); + // TODO: Factor this out + handle the lower level const pointers. ValuesToInvalidate.push_back(getArgSVal(Idx)); -- cgit v1.2.3