diff options
author | Anna Zaks <ganna@apple.com> | 2012-05-03 02:13:50 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-05-03 02:13:50 +0000 |
commit | baeaa9ad120f60b1c5b6f1a84286b507dbe2b55d (patch) | |
tree | 4fc516f9dc43482931de9277f46f91c00feb9e70 /lib/StaticAnalyzer/Core/SValBuilder.cpp | |
parent | 31595e22b7e0d21b0b7c4c4fb196e97d3edc2a08 (diff) |
[analyzer] Add a complexity bound on history tracking.
(Currently, this is only relevant for tainted data.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/SValBuilder.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/SValBuilder.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/StaticAnalyzer/Core/SValBuilder.cpp b/lib/StaticAnalyzer/Core/SValBuilder.cpp index a61cbe8761..d286f495cd 100644 --- a/lib/StaticAnalyzer/Core/SValBuilder.cpp +++ b/lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -204,15 +204,19 @@ SVal SValBuilder::makeSymExprValNN(ProgramStateRef State, const SymExpr *symLHS = LHS.getAsSymExpr(); const SymExpr *symRHS = RHS.getAsSymExpr(); + // TODO: When the Max Complexity is reached, we should conjure a symbol + // instead of generating an Unknown value and propagate the taint info to it. + const unsigned MaxComp = 10000; // 100000 28X - if (symLHS && symRHS) + if (symLHS && symRHS && + (symLHS->computeComplexity() + symRHS->computeComplexity()) < MaxComp) return makeNonLoc(symLHS, Op, symRHS, ResultTy); - if (symLHS) + if (symLHS && symLHS->computeComplexity() < MaxComp) if (const nonloc::ConcreteInt *rInt = dyn_cast<nonloc::ConcreteInt>(&RHS)) return makeNonLoc(symLHS, Op, rInt->getValue(), ResultTy); - if (symRHS) + if (symRHS && symRHS->computeComplexity() < MaxComp) if (const nonloc::ConcreteInt *lInt = dyn_cast<nonloc::ConcreteInt>(&LHS)) return makeNonLoc(lInt->getValue(), Op, symRHS, ResultTy); |