From c770cac9645d99a43228734ce033862f36bfe8a1 Mon Sep 17 00:00:00 2001 From: Kampfkarren Date: Wed, 27 Jul 2022 16:43:49 -0700 Subject: [PATCH] auto cleanup --- Ast/src/Lexer.cpp | 4 ++-- Ast/src/Parser.cpp | 4 ++-- Compiler/src/Compiler.cpp | 6 +++--- Compiler/src/CostModel.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Ast/src/Lexer.cpp b/Ast/src/Lexer.cpp index 8a369033..85064827 100644 --- a/Ast/src/Lexer.cpp +++ b/Ast/src/Lexer.cpp @@ -595,7 +595,7 @@ const Lexeme Lexer::nextInterpolatedString() Position start = position(); unsigned int startOffset = offset; - if (auto readSection = readInterpolatedStringSection(start, Lexeme::InterpStringMid)) + if (std::optional readSection = readInterpolatedStringSection(start, Lexeme::InterpStringMid)) { lexeme = *readSection; return lexeme; @@ -646,7 +646,7 @@ std::optional Lexer::readInterpolatedStringSection(Position start, Lexem return Lexeme(Location(start, position()), Lexeme::BrokenInterpDoubleBrace); } - auto lexemeOutput = Lexeme(Location(start, position()), Lexeme::InterpStringBegin, &buffer[startOffset], offset - startOffset); + Lexeme lexemeOutput(Location(start, position()), Lexeme::InterpStringBegin, &buffer[startOffset], offset - startOffset); consume(); return lexemeOutput; } diff --git a/Ast/src/Parser.cpp b/Ast/src/Parser.cpp index 4f3d5299..6b7dc854 100644 --- a/Ast/src/Parser.cpp +++ b/Ast/src/Parser.cpp @@ -2647,7 +2647,7 @@ AstExpr* Parser::parseInterpString() Location startLocation = lexer.current().location; do { - auto currentLexeme = lexer.current(); + Lexeme currentLexeme = lexer.current(); LUAU_ASSERT(currentLexeme.type == Lexeme::InterpStringBegin || currentLexeme.type == Lexeme::InterpStringMid || currentLexeme.type == Lexeme::InterpStringEnd); Location location = currentLexeme.location; @@ -2691,7 +2691,7 @@ AstExpr* Parser::parseInterpString() expressions.push_back(expression); - auto next = lexer.nextInterpolatedString(); + Lexeme next = lexer.nextInterpolatedString(); switch (next.type) { diff --git a/Compiler/src/Compiler.cpp b/Compiler/src/Compiler.cpp index e54fb628..77e35fcc 100644 --- a/Compiler/src/Compiler.cpp +++ b/Compiler/src/Compiler.cpp @@ -1507,15 +1507,15 @@ struct Compiler formatString += "%*"; } - auto formatStringSize = formatString.size(); + size_t formatStringSize = formatString.size(); // We can't use formatStringRef.data() directly, because short strings don't have their data // pinned in memory, so when interpFormatStrings grows, these pointers will move and become invalid. std::shared_ptr formatStringPtr(new char[formatStringSize]); memcpy(formatStringPtr.get(), formatString.data(), formatStringSize); - auto formatStringPtrRef = interpFormatStrings.emplace_back(formatStringPtr); - AstArray formatStringArray{formatStringPtrRef.get(), formatStringSize}; + interpFormatStrings.emplace_back(formatStringPtr); + AstArray formatStringArray{formatStringPtr.get(), formatStringSize}; int32_t formatStringIndex = bytecode.addConstantString(sref(formatStringArray)); if (formatStringIndex < 0) diff --git a/Compiler/src/CostModel.cpp b/Compiler/src/CostModel.cpp index 593a4bbf..6382de68 100644 --- a/Compiler/src/CostModel.cpp +++ b/Compiler/src/CostModel.cpp @@ -222,7 +222,7 @@ struct CostVisitor : AstVisitor // Baseline cost of string.format Cost cost = 3; - for (auto innerExpression : expr->expressions) + for (AstExpr* innerExpression : expr->expressions) cost += model(innerExpression); return cost;