forked from OSchip/llvm-project
Replacing a naked pointer with a unique_ptr. No functional changes intended.
llvm-svn: 206986
This commit is contained in:
parent
b834050953
commit
8e8026d5b3
|
@ -27,6 +27,7 @@
|
|||
#include "clang/Analysis/AnalysisContext.h"
|
||||
#include "clang/Basic/OperatorKinds.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
@ -234,15 +235,11 @@ public:
|
|||
};
|
||||
|
||||
SExprBuilder(til::MemRegionRef A)
|
||||
: Arena(A), SelfVar(nullptr), Scfg(nullptr), CallCtx(nullptr),
|
||||
CurrentBB(nullptr), CurrentBlockInfo(nullptr) {
|
||||
: Arena(A), SelfVar(nullptr), Scfg(nullptr), CurrentBB(nullptr),
|
||||
CurrentBlockInfo(nullptr) {
|
||||
// FIXME: we don't always have a self-variable.
|
||||
SelfVar = new (Arena) til::Variable(til::Variable::VK_SFun);
|
||||
}
|
||||
~SExprBuilder() {
|
||||
if (CallCtx)
|
||||
delete CallCtx;
|
||||
}
|
||||
|
||||
// Translate a clang statement or expression to a TIL expression.
|
||||
// Also performs substitution of variables; Ctx provides the context.
|
||||
|
@ -369,7 +366,7 @@ private:
|
|||
std::vector<til::BasicBlock *> BlockMap; // Map from clang to til BBs.
|
||||
std::vector<BlockInfo> BBInfo; // Extra information per BB.
|
||||
// Indexed by clang BlockID.
|
||||
SExprBuilder::CallingContext *CallCtx; // Root calling context
|
||||
std::unique_ptr<SExprBuilder::CallingContext> CallCtx; // Root calling context
|
||||
|
||||
LVarDefinitionMap CurrentLVarMap;
|
||||
std::vector<til::Variable*> CurrentArguments;
|
||||
|
|
|
@ -649,7 +649,7 @@ void SExprBuilder::enterCFG(CFG *Cfg, const FunctionDecl *FD,
|
|||
auto *BB = new (Arena) til::BasicBlock(Arena, 0, B->size());
|
||||
BlockMap[B->getBlockID()] = BB;
|
||||
}
|
||||
CallCtx = new SExprBuilder::CallingContext(FD);
|
||||
CallCtx.reset(new SExprBuilder::CallingContext(FD));
|
||||
|
||||
CurrentBB = lookupBlock(&Cfg->getEntry());
|
||||
for (auto *Pm : FD->parameters()) {
|
||||
|
@ -712,7 +712,7 @@ void SExprBuilder::enterCFGBlockBody(const CFGBlock *B) {
|
|||
|
||||
|
||||
void SExprBuilder::handleStatement(const Stmt *S) {
|
||||
til::SExpr *E = translate(S, CallCtx);
|
||||
til::SExpr *E = translate(S, CallCtx.get());
|
||||
addStatement(E, S);
|
||||
}
|
||||
|
||||
|
@ -744,7 +744,7 @@ void SExprBuilder::exitCFGBlockBody(const CFGBlock *B) {
|
|||
CurrentBB->setTerminator(Tm);
|
||||
}
|
||||
else if (N == 2) {
|
||||
til::SExpr *C = translate(B->getTerminatorCondition(true), CallCtx);
|
||||
til::SExpr *C = translate(B->getTerminatorCondition(true), CallCtx.get());
|
||||
til::BasicBlock *BB1 = *It ? lookupBlock(*It) : nullptr;
|
||||
++It;
|
||||
til::BasicBlock *BB2 = *It ? lookupBlock(*It) : nullptr;
|
||||
|
|
Loading…
Reference in New Issue