ScalarEvolution *SE;
// The Scop
- Scop *scop;
+ std::unique_ptr<Scop> scop;
isl_ctx *ctx;
// Clear the context.
/// @return If the current region is a valid for a static control part,
/// return the Polly IR representing this static control part,
/// return null otherwise.
- Scop *getScop() { return scop; }
- const Scop *getScop() const { return scop; }
+ Scop *getScop() { return scop.get(); }
+ const Scop *getScop() const { return scop.get(); }
/// @name RegionPass interface
//@{
void ScopInfo::buildScop(Region &R, AssumptionCache &AC) {
unsigned MaxLoopDepth = getMaxLoopDepthInRegion(R, *LI, *SD);
- scop = new Scop(R, *SE, ctx, MaxLoopDepth);
+ scop.reset(new Scop(R, *SE, ctx, MaxLoopDepth));
buildStmts(R, R);
buildAccessFunctions(R, R);
scop->print(OS);
}
-void ScopInfo::clear() {
- if (scop) {
- delete scop;
- scop = 0;
- }
-}
+void ScopInfo::clear() { scop.reset(); }
//===----------------------------------------------------------------------===//
-ScopInfo::ScopInfo() : RegionPass(ID), scop(0) {
+ScopInfo::ScopInfo() : RegionPass(ID) {
ctx = isl_ctx_alloc();
isl_options_set_on_error(ctx, ISL_ON_ERROR_ABORT);
}
if (scop->isEmpty() || !scop->hasFeasibleRuntimeContext()) {
Msg = "SCoP ends here but was dismissed.";
- delete scop;
- scop = nullptr;
+ scop.reset();
} else {
Msg = "SCoP ends here.";
++ScopFound;