Convert vectors to list aliases

This CL converts a few more std::vector<std::unique_ptr<foo>>'s to
FooList aliases.

Change-Id: If0dd672f11beaeabd9e89e82903c2174b11be6e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19103
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair 2020-04-08 19:58:28 +00:00 committed by dan sinclair
parent ee8ae04472
commit d5dea224e0
3 changed files with 4 additions and 7 deletions

View File

@ -92,7 +92,7 @@ bool FunctionEmitter::EmitFunctionDeclaration() {
<< function_.result_id(); << function_.result_id();
} }
std::vector<std::unique_ptr<ast::Variable>> ast_params; ast::VariableList ast_params;
function_.ForEachParam( function_.ForEachParam(
[this, &ast_params](const spvtools::opt::Instruction* param) { [this, &ast_params](const spvtools::opt::Instruction* param) {
auto* ast_type = parser_impl_.ConvertType(param->type_id()); auto* ast_type = parser_impl_.ConvertType(param->type_id());

View File

@ -53,9 +53,7 @@ class FunctionEmitter {
bool failed() const { return !success(); } bool failed() const { return !success(); }
/// @returns the body of the function. /// @returns the body of the function.
const std::vector<std::unique_ptr<ast::Statement>>& ast_body() { const ast::StatementList& ast_body() { return ast_body_; }
return ast_body_;
}
/// Records failure. /// Records failure.
/// @returns a FailStream on which to emit diagnostics. /// @returns a FailStream on which to emit diagnostics.
@ -91,7 +89,7 @@ class FunctionEmitter {
FailStream& fail_stream_; FailStream& fail_stream_;
Namer& namer_; Namer& namer_;
const spvtools::opt::Function& function_; const spvtools::opt::Function& function_;
std::vector<std::unique_ptr<ast::Statement>> ast_body_; ast::StatementList ast_body_;
}; };
} // namespace spirv } // namespace spirv

View File

@ -66,8 +66,7 @@ class SpvParserTest : public testing::Test {
/// Returns the string dump of a function body. /// Returns the string dump of a function body.
/// @param body the statement in the body /// @param body the statement in the body
/// @returnss the string dump of a function body. /// @returnss the string dump of a function body.
inline std::string ToString( inline std::string ToString(const ast::StatementList& body) {
const std::vector<std::unique_ptr<ast::Statement>>& body) {
std::ostringstream outs; std::ostringstream outs;
for (const auto& stmt : body) { for (const auto& stmt : body) {
stmt->to_str(outs, 0); stmt->to_str(outs, 0);