Prefer unique_ptr<> and make_xxxx over raw pointers and new.
There doesn't seem to be any reason to use a raw pointer for the IRGenerator. Change-Id: I5a37ff8ee212534dc8357722aaf70637623840bb Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313720 Commit-Queue: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
638b2e8594
commit
656427a553
@ -104,8 +104,8 @@ Compiler::Compiler(Flags flags)
|
||||
, fFlags(flags)
|
||||
, fContext(std::make_shared<Context>())
|
||||
, fErrorCount(0) {
|
||||
auto symbols = std::shared_ptr<SymbolTable>(new SymbolTable(this));
|
||||
fIRGenerator = new IRGenerator(fContext.get(), symbols, *this);
|
||||
auto symbols = std::make_shared<SymbolTable>(this);
|
||||
fIRGenerator = std::make_unique<IRGenerator>(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) {
|
||||
|
@ -241,7 +241,7 @@ private:
|
||||
std::vector<std::unique_ptr<ProgramElement>> fFPInclude;
|
||||
std::shared_ptr<SymbolTable> fFPSymbolTable;
|
||||
|
||||
IRGenerator* fIRGenerator;
|
||||
std::unique_ptr<IRGenerator> fIRGenerator;
|
||||
int fFlags;
|
||||
|
||||
const String* fSource;
|
||||
|
Loading…
Reference in New Issue
Block a user