Add Make factory functions to basic statements.
These are the simple cases like `break` and `continue` which don't have
any optimization opportunities, types to coerce, or errors to report.
We now have Make functions for consistency across our IRNodes, but they
don't contain any interesting logic.
Change-Id: Iefdb8e3dad66f131dc892f4a7dc647246bf2554e
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/383707
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp
index d30cbca..0d42f03 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -472,11 +472,11 @@
// This function doesn't return a value, but has early returns, so we've wrapped
// it in a for loop. Use a continue to jump to the end of the loop and "leave"
// the function.
- return std::make_unique<ContinueStatement>(offset);
+ return ContinueStatement::Make(offset);
} else {
// This function doesn't exit early or return a value. A return statement at the
// end is a no-op and can be treated as such.
- return std::make_unique<Nop>();
+ return Nop::Make();
}
}
@@ -486,7 +486,7 @@
SkASSERT(resultExpr);
if (returnComplexity <= ReturnComplexity::kSingleSafeReturn) {
*resultExpr = expr(r.expression());
- return std::make_unique<Nop>();
+ return Nop::Make();
}
// For more complex functions, assign their result into a variable.
@@ -505,7 +505,7 @@
StatementArray block;
block.reserve_back(2);
block.push_back(std::move(assignment));
- block.push_back(std::make_unique<ContinueStatement>(offset));
+ block.push_back(ContinueStatement::Make(offset));
return std::make_unique<Block>(offset, std::move(block), /*symbols=*/nullptr,
/*isScope=*/true);
}
@@ -635,7 +635,7 @@
arguments.size() + // Function arguments (copy out-params back)
1); // Block for inlined code
- inlinedBody.children().push_back(std::make_unique<InlineMarker>(&call->function()));
+ inlinedBody.children().push_back(InlineMarker::Make(&call->function()));
std::unique_ptr<Expression> resultExpr;
if (returnComplexity > ReturnComplexity::kSingleSafeReturn &&