Deleted Added
full compact
17a18
> #include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
27c28
< static void print(llvm::raw_ostream& os, BinaryOperator::Opcode Op) {
---
> static void print(raw_ostream &os, BinaryOperator::Opcode Op) {
30,31c31
< assert(false && "operator printing not implemented");
< break;
---
> llvm_unreachable("operator printing not implemented");
51c51
< void SymIntExpr::dumpToStream(llvm::raw_ostream& os) const {
---
> void SymIntExpr::dumpToStream(raw_ostream &os) const {
60c60
< void SymSymExpr::dumpToStream(llvm::raw_ostream& os) const {
---
> void SymSymExpr::dumpToStream(raw_ostream &os) const {
69c69
< void SymbolConjured::dumpToStream(llvm::raw_ostream& os) const {
---
> void SymbolConjured::dumpToStream(raw_ostream &os) const {
73c73
< void SymbolDerived::dumpToStream(llvm::raw_ostream& os) const {
---
> void SymbolDerived::dumpToStream(raw_ostream &os) const {
78c78
< void SymbolExtent::dumpToStream(llvm::raw_ostream& os) const {
---
> void SymbolExtent::dumpToStream(raw_ostream &os) const {
82c82
< void SymbolMetadata::dumpToStream(llvm::raw_ostream& os) const {
---
> void SymbolMetadata::dumpToStream(raw_ostream &os) const {
87c87
< void SymbolRegionValue::dumpToStream(llvm::raw_ostream& os) const {
---
> void SymbolRegionValue::dumpToStream(raw_ostream &os) const {
92c92
< SymbolManager::getRegionValueSymbol(const TypedRegion* R) {
---
> SymbolManager::getRegionValueSymbol(const TypedValueRegion* R) {
95c95
< void* InsertPos;
---
> void *InsertPos;
108,109c108,109
< SymbolManager::getConjuredSymbol(const Stmt* E, QualType T, unsigned Count,
< const void* SymbolTag) {
---
> SymbolManager::getConjuredSymbol(const Stmt *E, QualType T, unsigned Count,
> const void *SymbolTag) {
113c113
< void* InsertPos;
---
> void *InsertPos;
127c127
< const TypedRegion *R) {
---
> const TypedValueRegion *R) {
131c131
< void* InsertPos;
---
> void *InsertPos;
147c147
< void* InsertPos;
---
> void *InsertPos;
160,161c160,161
< SymbolManager::getMetadataSymbol(const MemRegion* R, const Stmt* S, QualType T,
< unsigned Count, const void* SymbolTag) {
---
> SymbolManager::getMetadataSymbol(const MemRegion* R, const Stmt *S, QualType T,
> unsigned Count, const void *SymbolTag) {
165c165
< void* InsertPos;
---
> void *InsertPos;
217c217
< QualType SymbolDerived::getType(ASTContext& Ctx) const {
---
> QualType SymbolDerived::getType(ASTContext &Ctx) const {
221c221
< QualType SymbolExtent::getType(ASTContext& Ctx) const {
---
> QualType SymbolExtent::getType(ASTContext &Ctx) const {
229c229
< QualType SymbolRegionValue::getType(ASTContext& C) const {
---
> QualType SymbolRegionValue::getType(ASTContext &C) const {
233c233,237
< SymbolManager::~SymbolManager() {}
---
> SymbolManager::~SymbolManager() {
> for (SymbolDependTy::const_iterator I = SymbolDependencies.begin(),
> E = SymbolDependencies.end(); I != E; ++I) {
> delete I->second;
> }
234a239,240
> }
>
249a256,294
> void SymbolManager::addSymbolDependency(const SymbolRef Primary,
> const SymbolRef Dependent) {
> SymbolDependTy::iterator I = SymbolDependencies.find(Primary);
> SymbolRefSmallVectorTy *dependencies = 0;
> if (I == SymbolDependencies.end()) {
> dependencies = new SymbolRefSmallVectorTy();
> SymbolDependencies[Primary] = dependencies;
> } else {
> dependencies = I->second;
> }
> dependencies->push_back(Dependent);
> }
>
> const SymbolRefSmallVectorTy *SymbolManager::getDependentSymbols(
> const SymbolRef Primary) {
> SymbolDependTy::const_iterator I = SymbolDependencies.find(Primary);
> if (I == SymbolDependencies.end())
> return 0;
> return I->second;
> }
>
> void SymbolReaper::markDependentsLive(SymbolRef sym) {
> // Do not mark dependents more then once.
> SymbolMapTy::iterator LI = TheLiving.find(sym);
> assert(LI != TheLiving.end() && "The primary symbol is not live.");
> if (LI->second == HaveMarkedDependents)
> return;
> LI->second = HaveMarkedDependents;
>
> if (const SymbolRefSmallVectorTy *Deps = SymMgr.getDependentSymbols(sym)) {
> for (SymbolRefSmallVectorTy::const_iterator I = Deps->begin(),
> E = Deps->end(); I != E; ++I) {
> if (TheLiving.find(*I) != TheLiving.end())
> continue;
> markLive(*I);
> }
> }
> }
>
251c296
< TheLiving.insert(sym);
---
> TheLiving[sym] = NotProcessed;
252a298
> markDependentsLive(sym);
254a301,304
> void SymbolReaper::markLive(const MemRegion *region) {
> RegionRoots.insert(region);
> }
>
268c318,321
< static bool IsLiveRegion(SymbolReaper &Reaper, const MemRegion *MR) {
---
> bool SymbolReaper::isLiveRegion(const MemRegion *MR) {
> if (RegionRoots.count(MR))
> return true;
>
272c325
< return Reaper.isLive(SR->getSymbol());
---
> return isLive(SR->getSymbol());
275c328
< return Reaper.isLive(VR);
---
> return isLive(VR, true);
294c347,348
< if (TheLiving.count(sym))
---
> if (TheLiving.count(sym)) {
> markDependentsLive(sym);
295a350
> }
306c361
< if (IsLiveRegion(*this, extent->getRegion())) {
---
> if (isLiveRegion(extent->getRegion())) {
315c370
< if (IsLiveRegion(*this, metadata->getRegion())) {
---
> if (isLiveRegion(metadata->getRegion())) {
329,331c384,385
< bool SymbolReaper::isLive(const Stmt* ExprVal) const {
< return LCtx->getAnalysisContext()->getRelaxedLiveVariables()->
< isLive(Loc, ExprVal);
---
> bool SymbolReaper::isLive(const Stmt *ExprVal) const {
> return LCtx->getAnalysis<RelaxedLiveVariables>()->isLive(Loc, ExprVal);
334c388
< bool SymbolReaper::isLive(const VarRegion *VR) const {
---
> bool SymbolReaper::isLive(const VarRegion *VR, bool includeStoreBindings) const{
338,340c392,394
< if (VarContext == CurrentContext)
< return LCtx->getAnalysisContext()->getRelaxedLiveVariables()->
< isLive(Loc, VR->getDecl());
---
> if (VarContext == CurrentContext) {
> if (LCtx->getAnalysis<RelaxedLiveVariables>()->isLive(Loc, VR->getDecl()))
> return true;
341a396,416
> if (!includeStoreBindings)
> return false;
>
> unsigned &cachedQuery =
> const_cast<SymbolReaper*>(this)->includedRegionCache[VR];
>
> if (cachedQuery) {
> return cachedQuery == 1;
> }
>
> // Query the store to see if the region occurs in any live bindings.
> if (Store store = reapedStore.getStore()) {
> bool hasRegion =
> reapedStore.getStoreManager().includedInBindings(store, VR);
> cachedQuery = hasRegion ? 1 : 2;
> return hasRegion;
> }
>
> return false;
> }
>