aboutsummaryrefslogtreecommitdiff
path: root/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-08-12 00:34:56 +0000
committerAnna Zaks <ganna@apple.com>2011-08-12 00:34:56 +0000
commit579ad7ac56f7940cc543b7216ee1b1a7de1ed712 (patch)
tree9a52881f802529434356de32264e06601a8984c8 /include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
parent6bf2b9fbd3e3adc38d4712de79aeaa81d651aa08 (diff)
Optimizations for Dependent Symbol tracking (as per Ted's code review for r137309):
1) Change SymbolDependTy map to keep pointers as data. And other small tweaks like making the DenseMap smaller 64->16 elements; remove removeSymbolDependencies() as it will probably not be used. 2) Do not mark dependents live more then once. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137401 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h')
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
index dc3d15b259..55ef1119e8 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
@@ -91,7 +91,7 @@ public:
};
typedef const SymbolData* SymbolRef;
-typedef llvm::SmallVector<SymbolRef, 1> SymbolRefSmallVectorTy;
+typedef llvm::SmallVector<SymbolRef, 2> SymbolRefSmallVectorTy;
/// A symbol representing the value of a MemRegion.
class SymbolRegionValue : public SymbolData {
@@ -358,7 +358,7 @@ public:
class SymbolManager {
typedef llvm::FoldingSet<SymExpr> DataSetTy;
- typedef llvm::DenseMap<SymbolRef, SymbolRefSmallVectorTy> SymbolDependTy;
+ typedef llvm::DenseMap<SymbolRef, SymbolRefSmallVectorTy*> SymbolDependTy;
DataSetTy DataSet;
/// Stores the extra dependencies between symbols: the data should be kept
@@ -372,7 +372,8 @@ class SymbolManager {
public:
SymbolManager(ASTContext& ctx, BasicValueFactory &bv,
llvm::BumpPtrAllocator& bpalloc)
- : SymbolCounter(0), BPAlloc(bpalloc), BV(bv), Ctx(ctx) {}
+ : SymbolDependencies(16), SymbolCounter(0),
+ BPAlloc(bpalloc), BV(bv), Ctx(ctx) {}
~SymbolManager();
@@ -423,9 +424,6 @@ public:
/// The dependent symbol should stay alive as long as the primary is alive.
void addSymbolDependency(const SymbolRef Primary, const SymbolRef Dependent);
- /// \brief Drop all user-added dependencies on the primary symbol.
- void removeSymbolDependencies(const SymbolRef Primary);
-
const SymbolRefSmallVectorTy *getDependentSymbols(const SymbolRef Primary);
ASTContext &getContext() { return Ctx; }
@@ -433,10 +431,16 @@ public:
};
class SymbolReaper {
+ enum SymbolStatus {
+ NotProcessed,
+ HaveMarkedDependents
+ };
+
typedef llvm::DenseSet<SymbolRef> SymbolSetTy;
+ typedef llvm::DenseMap<SymbolRef, SymbolStatus> SymbolMapTy;
typedef llvm::DenseSet<const MemRegion *> RegionSetTy;
- SymbolSetTy TheLiving;
+ SymbolMapTy TheLiving;
SymbolSetTy MetadataInUse;
SymbolSetTy TheDead;