[analyzer] Be lazy about struct/array global invalidation too.

Structs and arrays can take advantage of the single top-level global
symbol optimization (described in the previous commit) just as well
as scalars.

No intended behavioral change.

llvm-svn: 179555
This commit is contained in:
Jordan Rose 2013-04-15 20:39:48 +00:00
parent fa80736bca
commit 2820e3dfca
1 changed files with 7 additions and 10 deletions

View File

@ -1040,7 +1040,13 @@ void invalidateRegionsWorker::VisitCluster(const MemRegion *baseR,
const TypedValueRegion *TR = cast<TypedValueRegion>(baseR);
QualType T = TR->getValueType();
// Invalidate the binding.
if (isInitiallyIncludedGlobalRegion(baseR)) {
// If the region is a global and we are invalidating all globals,
// erasing the entry is good enough. This causes all globals to be lazily
// symbolicated from the same base symbol.
return;
}
if (T->isStructureOrClassType()) {
// Invalidate the region by setting its default value to
// conjured symbol. The type of the symbol is irrelavant.
@ -1058,15 +1064,6 @@ void invalidateRegionsWorker::VisitCluster(const MemRegion *baseR,
B = B.addBinding(baseR, BindingKey::Default, V);
return;
}
if (isInitiallyIncludedGlobalRegion(baseR)) {
// If the region is a global and we are invalidating all globals,
// just erase the entry. This causes all globals to be lazily
// symbolicated from the same base symbol.
B = B.removeBinding(baseR);
return;
}
DefinedOrUnknownSVal V = svalBuilder.conjureSymbolVal(baseR, Ex, LCtx,
T,Count);