Convert make_unique<ExpressionStatement> to ExpressionStatement::Make.
This allows for elimination expression-statements with no side effects
when they are first created, rather than later on in the control-flow
optimization pass.
Change-Id: I09ec8421a3af7fa37f98b0405657198c0a24f2ac
Bug: skia:11342, skia:11319
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376136
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLRehydrator.cpp b/src/sksl/SkSLRehydrator.cpp
index a220235..781827c 100644
--- a/src/sksl/SkSLRehydrator.cpp
+++ b/src/sksl/SkSLRehydrator.cpp
@@ -368,7 +368,7 @@
}
case Rehydrator::kExpressionStatement_Command: {
std::unique_ptr<Expression> expr = this->expression();
- return std::unique_ptr<Statement>(new ExpressionStatement(std::move(expr)));
+ return ExpressionStatement::Make(fContext, std::move(expr));
}
case Rehydrator::kFor_Command: {
std::unique_ptr<Statement> initializer = this->statement();