diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp index 85702b9870..488b49f106 100644 --- a/src/sksl/SkSLCompiler.cpp +++ b/src/sksl/SkSLCompiler.cpp @@ -104,8 +104,8 @@ Compiler::Compiler(Flags flags) , fFlags(flags) , fContext(std::make_shared()) , fErrorCount(0) { - auto symbols = std::shared_ptr(new SymbolTable(this)); - fIRGenerator = new IRGenerator(fContext.get(), symbols, *this); + auto symbols = std::make_shared(this); + fIRGenerator = std::make_unique(fContext.get(), symbols, *this); #define ADD_TYPE(t) symbols->addWithoutOwnership(fContext->f ## t ## _Type->fName, \ fContext->f ## t ## _Type.get()) ADD_TYPE(Void); @@ -272,9 +272,7 @@ Compiler::Compiler(Flags flags) grab_intrinsics(&interpIntrinsics, fInterpreterIntrinsics.get()); } -Compiler::~Compiler() { - delete fIRGenerator; -} +Compiler::~Compiler() {} void Compiler::loadGeometryIntrinsics() { if (fGeometrySymbolTable) { diff --git a/src/sksl/SkSLCompiler.h b/src/sksl/SkSLCompiler.h index ca9abaecad..4070d67086 100644 --- a/src/sksl/SkSLCompiler.h +++ b/src/sksl/SkSLCompiler.h @@ -241,7 +241,7 @@ private: std::vector> fFPInclude; std::shared_ptr fFPSymbolTable; - IRGenerator* fIRGenerator; + std::unique_ptr fIRGenerator; int fFlags; const String* fSource;