5 #ifndef CLEARBLUE_YSPSASTATEBUILDER_H
6 #define CLEARBLUE_YSPSASTATEBUILDER_H
8 #include "Checker/PSA/SummaryBase.h"
9 #include "Checker/PSA/VulnerabilityTraceBuilder.h"
10 #include "IR/SEG/SymbolicExprGraphSolver.h"
13 public VulnerabilityTraceBuilder {
15 PushPopCache<const SEGObject *> SEGObjectCache;
16 PushPopVector<SummaryCacheItem> NonSymDepsCache;
17 PushPopVector<SummaryCacheItem> SymDepsCache;
21 ExternalMemorySpec *MemSepc, ExternalIOSpec *IOSpec)
23 VulnerabilityTraceBuilder() {}
28 SymbolicExprGraphSolver::push();
29 VulnerabilityTraceBuilder::push();
30 SEGObjectCache.push();
32 NonSymDepsCache.push();
36 SymbolicExprGraphSolver::pop();
37 VulnerabilityTraceBuilder::pop();
40 NonSymDepsCache.pop();
44 SymbolicExprGraphSolver::reset();
45 VulnerabilityTraceBuilder::reset();
46 SEGObjectCache.reset();
48 NonSymDepsCache.reset();
52 VulnerabilityTraceBuilder::add(O);
53 SEGObjectCache.add(O);
56 void recordState(
const std::shared_ptr<VulnerabilityTrace> &T) {
57 VulnerabilityTraceBuilder::add(T);
60 void recordState(
const SMTExpr &E) { SymbolicExprGraphSolver::add(E); }
62 void recordState(
const SMTExprVec &EV) {
63 SymbolicExprGraphSolver::addAll(EV);
66 void recordState(
const SummaryCacheItem &SCI,
bool Sym) {
68 SymDepsCache.push_back(SCI);
70 NonSymDepsCache.push_back(SCI);
74 bool hasState(
const SEGObject *O)
const {
return SEGObjectCache.contains(O); }
77 std::vector<SummaryCacheItem>::const_iterator sym_dep_begin()
const {
78 return SymDepsCache.getCacheVector().begin();
81 std::vector<SummaryCacheItem>::const_iterator sym_dep_end()
const {
82 return SymDepsCache.getCacheVector().end();
85 std::vector<SummaryCacheItem>::const_iterator nonsym_dep_begin()
const {
86 return NonSymDepsCache.getCacheVector().begin();
89 std::vector<SummaryCacheItem>::const_iterator nonsym_dep_end()
const {
90 return NonSymDepsCache.getCacheVector().end();
94 #endif // CLEARBLUE_YSPSASTATEBUILDER_H