class SymbolManager {
using DataSetTy = llvm::FoldingSet<SymExpr>;
- using SymbolDependTy = llvm::DenseMap<SymbolRef, SymbolRefSmallVectorTy *>;
+ using SymbolDependTy =
+ llvm::DenseMap<SymbolRef, std::unique_ptr<SymbolRefSmallVectorTy>>;
DataSetTy DataSet;
SymbolManager(ASTContext &ctx, BasicValueFactory &bv,
llvm::BumpPtrAllocator& bpalloc)
: SymbolDependencies(16), BPAlloc(bpalloc), BV(bv), Ctx(ctx) {}
- ~SymbolManager();
static bool canSymbolicate(QualType T);
return R->getValueType();
}
-SymbolManager::~SymbolManager() {
- llvm::DeleteContainerSeconds(SymbolDependencies);
-}
-
bool SymbolManager::canSymbolicate(QualType T) {
T = T.getCanonicalType();
void SymbolManager::addSymbolDependency(const SymbolRef Primary,
const SymbolRef Dependent) {
- SymbolDependTy::iterator I = SymbolDependencies.find(Primary);
- SymbolRefSmallVectorTy *dependencies = nullptr;
- if (I == SymbolDependencies.end()) {
- dependencies = new SymbolRefSmallVectorTy();
- SymbolDependencies[Primary] = dependencies;
- } else {
- dependencies = I->second;
+ auto &dependencies = SymbolDependencies[Primary];
+ if (!dependencies) {
+ dependencies = std::make_unique<SymbolRefSmallVectorTy>();
}
dependencies->push_back(Dependent);
}
SymbolDependTy::const_iterator I = SymbolDependencies.find(Primary);
if (I == SymbolDependencies.end())
return nullptr;
- return I->second;
+ return I->second.get();
}
void SymbolReaper::markDependentsLive(SymbolRef sym) {