diff options
Diffstat (limited to 'src/sksl/ir')
42 files changed, 94 insertions, 93 deletions
diff --git a/src/sksl/ir/SkSLBinaryExpression.h b/src/sksl/ir/SkSLBinaryExpression.h index 132513e7f7..9ecdbc717c 100644 --- a/src/sksl/ir/SkSLBinaryExpression.h +++ b/src/sksl/ir/SkSLBinaryExpression.h @@ -24,7 +24,7 @@ struct BinaryExpression : public Expression { , fOperator(op) , fRight(std::move(right)) {} - virtual SkString description() const override { + virtual std::string description() const override { return "(" + fLeft->description() + " " + Token::OperatorName(fOperator) + " " + fRight->description() + ")"; } diff --git a/src/sksl/ir/SkSLBlock.h b/src/sksl/ir/SkSLBlock.h index f975d160a0..a53d13d169 100644 --- a/src/sksl/ir/SkSLBlock.h +++ b/src/sksl/ir/SkSLBlock.h @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ - + #ifndef SKSL_BLOCK #define SKSL_BLOCK @@ -23,14 +23,14 @@ struct Block : public Statement { , fStatements(std::move(statements)) , fSymbols(std::move(symbols)) {} - SkString description() const override { - SkString result("{"); + std::string description() const override { + std::string result = "{"; for (size_t i = 0; i < fStatements.size(); i++) { result += "\n"; result += fStatements[i]->description(); } result += "\n}\n"; - return result; + return result; } const std::vector<std::unique_ptr<Statement>> fStatements; diff --git a/src/sksl/ir/SkSLBoolLiteral.h b/src/sksl/ir/SkSLBoolLiteral.h index b372f2f3ff..ba054e4181 100644 --- a/src/sksl/ir/SkSLBoolLiteral.h +++ b/src/sksl/ir/SkSLBoolLiteral.h @@ -21,8 +21,8 @@ struct BoolLiteral : public Expression { : INHERITED(position, kBoolLiteral_Kind, *context.fBool_Type) , fValue(value) {} - SkString description() const override { - return SkString(fValue ? "true" : "false"); + std::string description() const override { + return fValue ? "true" : "false"; } bool isConstant() const override { diff --git a/src/sksl/ir/SkSLBreakStatement.h b/src/sksl/ir/SkSLBreakStatement.h index cd633c7a91..8aa17b096b 100644 --- a/src/sksl/ir/SkSLBreakStatement.h +++ b/src/sksl/ir/SkSLBreakStatement.h @@ -20,8 +20,8 @@ struct BreakStatement : public Statement { BreakStatement(Position position) : INHERITED(position, kBreak_Kind) {} - SkString description() const override { - return SkString("break;"); + std::string description() const override { + return "break;"; } typedef Statement INHERITED; diff --git a/src/sksl/ir/SkSLConstructor.h b/src/sksl/ir/SkSLConstructor.h index 92f758032b..0501b651ea 100644 --- a/src/sksl/ir/SkSLConstructor.h +++ b/src/sksl/ir/SkSLConstructor.h @@ -21,9 +21,9 @@ struct Constructor : public Expression { : INHERITED(position, kConstructor_Kind, type) , fArguments(std::move(arguments)) {} - SkString description() const override { - SkString result = fType.description() + "("; - SkString separator; + std::string description() const override { + std::string result = fType.description() + "("; + std::string separator = ""; for (size_t i = 0; i < fArguments.size(); i++) { result += separator; result += fArguments[i]->description(); diff --git a/src/sksl/ir/SkSLContinueStatement.h b/src/sksl/ir/SkSLContinueStatement.h index b4446940cf..1951bd990a 100644 --- a/src/sksl/ir/SkSLContinueStatement.h +++ b/src/sksl/ir/SkSLContinueStatement.h @@ -20,8 +20,8 @@ struct ContinueStatement : public Statement { ContinueStatement(Position position) : INHERITED(position, kContinue_Kind) {} - SkString description() const override { - return SkString("continue;"); + std::string description() const override { + return "continue;"; } typedef Statement INHERITED; diff --git a/src/sksl/ir/SkSLDiscardStatement.h b/src/sksl/ir/SkSLDiscardStatement.h index 3ab6b27047..b39712ebd1 100644 --- a/src/sksl/ir/SkSLDiscardStatement.h +++ b/src/sksl/ir/SkSLDiscardStatement.h @@ -20,8 +20,8 @@ struct DiscardStatement : public Statement { DiscardStatement(Position position) : INHERITED(position, kDiscard_Kind) {} - SkString description() const override { - return SkString("discard;"); + std::string description() const override { + return "discard;"; } typedef Statement INHERITED; diff --git a/src/sksl/ir/SkSLDoStatement.h b/src/sksl/ir/SkSLDoStatement.h index 78c0a1b768..6012453277 100644 --- a/src/sksl/ir/SkSLDoStatement.h +++ b/src/sksl/ir/SkSLDoStatement.h @@ -23,7 +23,7 @@ struct DoStatement : public Statement { , fStatement(std::move(statement)) , fTest(std::move(test)) {} - SkString description() const override { + std::string description() const override { return "do " + fStatement->description() + " while (" + fTest->description() + ");"; } diff --git a/src/sksl/ir/SkSLExpressionStatement.h b/src/sksl/ir/SkSLExpressionStatement.h index 677c647587..e975ccf2ac 100644 --- a/src/sksl/ir/SkSLExpressionStatement.h +++ b/src/sksl/ir/SkSLExpressionStatement.h @@ -21,7 +21,7 @@ struct ExpressionStatement : public Statement { : INHERITED(expression->fPosition, kExpression_Kind) , fExpression(std::move(expression)) {} - SkString description() const override { + std::string description() const override { return fExpression->description() + ";"; } diff --git a/src/sksl/ir/SkSLExtension.h b/src/sksl/ir/SkSLExtension.h index ea5e0445e3..d7f83fad8a 100644 --- a/src/sksl/ir/SkSLExtension.h +++ b/src/sksl/ir/SkSLExtension.h @@ -16,15 +16,15 @@ namespace SkSL { * An extension declaration. */ struct Extension : public ProgramElement { - Extension(Position position, SkString name) + Extension(Position position, std::string name) : INHERITED(position, kExtension_Kind) , fName(std::move(name)) {} - SkString description() const override { + std::string description() const override { return "#extension " + fName + " : enable"; } - const SkString fName; + const std::string fName; typedef ProgramElement INHERITED; }; diff --git a/src/sksl/ir/SkSLField.h b/src/sksl/ir/SkSLField.h index f73b6025ec..a01df2943d 100644 --- a/src/sksl/ir/SkSLField.h +++ b/src/sksl/ir/SkSLField.h @@ -26,7 +26,7 @@ struct Field : public Symbol { , fOwner(owner) , fFieldIndex(fieldIndex) {} - virtual SkString description() const override { + virtual std::string description() const override { return fOwner.description() + "." + fOwner.fType.fields()[fFieldIndex].fName; } diff --git a/src/sksl/ir/SkSLFieldAccess.h b/src/sksl/ir/SkSLFieldAccess.h index fb727e017e..4be4e9e84c 100644 --- a/src/sksl/ir/SkSLFieldAccess.h +++ b/src/sksl/ir/SkSLFieldAccess.h @@ -31,7 +31,7 @@ struct FieldAccess : public Expression { , fFieldIndex(fieldIndex) , fOwnerKind(ownerKind) {} - virtual SkString description() const override { + virtual std::string description() const override { return fBase->description() + "." + fBase->fType.fields()[fFieldIndex].fName; } diff --git a/src/sksl/ir/SkSLFloatLiteral.h b/src/sksl/ir/SkSLFloatLiteral.h index 8a1a5ad63a..a8fcfcf644 100644 --- a/src/sksl/ir/SkSLFloatLiteral.h +++ b/src/sksl/ir/SkSLFloatLiteral.h @@ -21,7 +21,7 @@ struct FloatLiteral : public Expression { : INHERITED(position, kFloatLiteral_Kind, *context.fFloat_Type) , fValue(value) {} - virtual SkString description() const override { + virtual std::string description() const override { return to_string(fValue); } diff --git a/src/sksl/ir/SkSLForStatement.h b/src/sksl/ir/SkSLForStatement.h index ff03d0d7f9..642d15125e 100644 --- a/src/sksl/ir/SkSLForStatement.h +++ b/src/sksl/ir/SkSLForStatement.h @@ -28,8 +28,8 @@ struct ForStatement : public Statement { , fStatement(std::move(statement)) , fSymbols(symbols) {} - SkString description() const override { - SkString result("for ("); + std::string description() const override { + std::string result = "for ("; if (fInitializer) { result += fInitializer->description(); } diff --git a/src/sksl/ir/SkSLFunctionCall.h b/src/sksl/ir/SkSLFunctionCall.h index 971af366b9..5c67a2873c 100644 --- a/src/sksl/ir/SkSLFunctionCall.h +++ b/src/sksl/ir/SkSLFunctionCall.h @@ -23,9 +23,9 @@ struct FunctionCall : public Expression { , fFunction(std::move(function)) , fArguments(std::move(arguments)) {} - SkString description() const override { - SkString result = fFunction.fName + "("; - SkString separator; + std::string description() const override { + std::string result = fFunction.fName + "("; + std::string separator = ""; for (size_t i = 0; i < fArguments.size(); i++) { result += separator; result += fArguments[i]->description(); diff --git a/src/sksl/ir/SkSLFunctionDeclaration.h b/src/sksl/ir/SkSLFunctionDeclaration.h index c15d2b96dc..52a579a89b 100644 --- a/src/sksl/ir/SkSLFunctionDeclaration.h +++ b/src/sksl/ir/SkSLFunctionDeclaration.h @@ -21,7 +21,7 @@ namespace SkSL { * A function declaration (not a definition -- does not contain a body). */ struct FunctionDeclaration : public Symbol { - FunctionDeclaration(Position position, SkString name, + FunctionDeclaration(Position position, std::string name, std::vector<const Variable*> parameters, const Type& returnType) : INHERITED(position, kFunctionDeclaration_Kind, std::move(name)) , fDefined(false) @@ -29,9 +29,9 @@ struct FunctionDeclaration : public Symbol { , fParameters(std::move(parameters)) , fReturnType(returnType) {} - SkString description() const override { - SkString result = fReturnType.description() + " " + fName + "("; - SkString separator; + std::string description() const override { + std::string result = fReturnType.description() + " " + fName + "("; + std::string separator = ""; for (auto p : fParameters) { result += separator; separator = ", "; diff --git a/src/sksl/ir/SkSLFunctionDefinition.h b/src/sksl/ir/SkSLFunctionDefinition.h index bae882525a..ace27a3ed8 100644 --- a/src/sksl/ir/SkSLFunctionDefinition.h +++ b/src/sksl/ir/SkSLFunctionDefinition.h @@ -24,7 +24,7 @@ struct FunctionDefinition : public ProgramElement { , fDeclaration(declaration) , fBody(std::move(body)) {} - SkString description() const override { + std::string description() const override { return fDeclaration.description() + " " + fBody->description(); } diff --git a/src/sksl/ir/SkSLFunctionReference.h b/src/sksl/ir/SkSLFunctionReference.h index ec1fc3804c..f3f8fb71da 100644 --- a/src/sksl/ir/SkSLFunctionReference.h +++ b/src/sksl/ir/SkSLFunctionReference.h @@ -23,9 +23,9 @@ struct FunctionReference : public Expression { : INHERITED(position, kFunctionReference_Kind, *context.fInvalid_Type) , fFunctions(function) {} - virtual SkString description() const override { + virtual std::string description() const override { ASSERT(false); - return SkString("<function>"); + return "<function>"; } const std::vector<const FunctionDeclaration*> fFunctions; diff --git a/src/sksl/ir/SkSLIRNode.h b/src/sksl/ir/SkSLIRNode.h index 9a04cddec5..8c433cfc6b 100644 --- a/src/sksl/ir/SkSLIRNode.h +++ b/src/sksl/ir/SkSLIRNode.h @@ -22,7 +22,7 @@ struct IRNode { virtual ~IRNode() {} - virtual SkString description() const = 0; + virtual std::string description() const = 0; const Position fPosition; }; diff --git a/src/sksl/ir/SkSLIfStatement.h b/src/sksl/ir/SkSLIfStatement.h index f8beded9e8..8ab5c00fd7 100644 --- a/src/sksl/ir/SkSLIfStatement.h +++ b/src/sksl/ir/SkSLIfStatement.h @@ -24,8 +24,8 @@ struct IfStatement : public Statement { , fIfTrue(std::move(ifTrue)) , fIfFalse(std::move(ifFalse)) {} - SkString description() const override { - SkString result = "if (" + fTest->description() + ") " + fIfTrue->description(); + std::string description() const override { + std::string result = "if (" + fTest->description() + ") " + fIfTrue->description(); if (fIfFalse) { result += " else " + fIfFalse->description(); } diff --git a/src/sksl/ir/SkSLIndexExpression.h b/src/sksl/ir/SkSLIndexExpression.h index 079dde5e53..abd8a03fa4 100644 --- a/src/sksl/ir/SkSLIndexExpression.h +++ b/src/sksl/ir/SkSLIndexExpression.h @@ -51,7 +51,7 @@ struct IndexExpression : public Expression { ASSERT(fIndex->fType == *context.fInt_Type || fIndex->fType == *context.fUInt_Type); } - SkString description() const override { + std::string description() const override { return fBase->description() + "[" + fIndex->description() + "]"; } diff --git a/src/sksl/ir/SkSLIntLiteral.h b/src/sksl/ir/SkSLIntLiteral.h index 23325e65fb..8921c283b5 100644 --- a/src/sksl/ir/SkSLIntLiteral.h +++ b/src/sksl/ir/SkSLIntLiteral.h @@ -22,7 +22,7 @@ struct IntLiteral : public Expression { : INHERITED(position, kIntLiteral_Kind, type ? *type : *context.fInt_Type) , fValue(value) {} - virtual SkString description() const override { + virtual std::string description() const override { return to_string(fValue); } diff --git a/src/sksl/ir/SkSLInterfaceBlock.h b/src/sksl/ir/SkSLInterfaceBlock.h index bc84396b2d..debde207a1 100644 --- a/src/sksl/ir/SkSLInterfaceBlock.h +++ b/src/sksl/ir/SkSLInterfaceBlock.h @@ -31,8 +31,8 @@ struct InterfaceBlock : public ProgramElement { ASSERT(fVariable.fType.kind() == Type::kStruct_Kind); } - SkString description() const override { - SkString result = fVariable.fModifiers.description() + fVariable.fName + " {\n"; + std::string description() const override { + std::string result = fVariable.fModifiers.description() + fVariable.fName + " {\n"; for (size_t i = 0; i < fVariable.fType.fields().size(); i++) { result += fVariable.fType.fields()[i].description() + "\n"; } diff --git a/src/sksl/ir/SkSLLayout.h b/src/sksl/ir/SkSLLayout.h index 7359262c96..4cfd1a2771 100644 --- a/src/sksl/ir/SkSLLayout.h +++ b/src/sksl/ir/SkSLLayout.h @@ -50,9 +50,9 @@ struct Layout { , fBlendSupportAllEquations(false) , fFormat(ASTLayout::Format::kUnspecified) {} - SkString description() const { - SkString result; - SkString separator; + std::string description() const { + std::string result; + std::string separator; if (fLocation >= 0) { result += separator + "location = " + to_string(fLocation); separator = ", "; @@ -89,7 +89,7 @@ struct Layout { result += separator + ASTLayout::FormatToStr(fFormat); separator = ", "; } - if (result.size() > 0) { + if (result.length() > 0) { result = "layout (" + result + ")"; } return result; diff --git a/src/sksl/ir/SkSLModifiers.h b/src/sksl/ir/SkSLModifiers.h index 2c9b3b39c9..f39e92959f 100644 --- a/src/sksl/ir/SkSLModifiers.h +++ b/src/sksl/ir/SkSLModifiers.h @@ -38,8 +38,8 @@ struct Modifiers { : fLayout(layout) , fFlags(flags) {} - SkString description() const { - SkString result = fLayout.description(); + std::string description() const { + std::string result = fLayout.description(); if (fFlags & kUniform_Flag) { result += "uniform "; } diff --git a/src/sksl/ir/SkSLModifiersDeclaration.h b/src/sksl/ir/SkSLModifiersDeclaration.h index 625954d7c7..0066fab877 100644 --- a/src/sksl/ir/SkSLModifiersDeclaration.h +++ b/src/sksl/ir/SkSLModifiersDeclaration.h @@ -23,7 +23,7 @@ struct ModifiersDeclaration : public ProgramElement { : INHERITED(Position(), kModifiers_Kind) , fModifiers(modifiers) {} - SkString description() const { + std::string description() const { return fModifiers.description() + ";"; } diff --git a/src/sksl/ir/SkSLPostfixExpression.h b/src/sksl/ir/SkSLPostfixExpression.h index 01671b5b88..de146ac43c 100644 --- a/src/sksl/ir/SkSLPostfixExpression.h +++ b/src/sksl/ir/SkSLPostfixExpression.h @@ -21,7 +21,7 @@ struct PostfixExpression : public Expression { , fOperand(std::move(operand)) , fOperator(op) {} - virtual SkString description() const override { + virtual std::string description() const override { return fOperand->description() + Token::OperatorName(fOperator); } diff --git a/src/sksl/ir/SkSLPrefixExpression.h b/src/sksl/ir/SkSLPrefixExpression.h index 790c5ab47a..53c3849b38 100644 --- a/src/sksl/ir/SkSLPrefixExpression.h +++ b/src/sksl/ir/SkSLPrefixExpression.h @@ -21,7 +21,7 @@ struct PrefixExpression : public Expression { , fOperand(std::move(operand)) , fOperator(op) {} - virtual SkString description() const override { + virtual std::string description() const override { return Token::OperatorName(fOperator) + fOperand->description(); } diff --git a/src/sksl/ir/SkSLReturnStatement.h b/src/sksl/ir/SkSLReturnStatement.h index c83b45066e..ec2226cc56 100644 --- a/src/sksl/ir/SkSLReturnStatement.h +++ b/src/sksl/ir/SkSLReturnStatement.h @@ -24,11 +24,11 @@ struct ReturnStatement : public Statement { : INHERITED(expression->fPosition, kReturn_Kind) , fExpression(std::move(expression)) {} - SkString description() const override { + std::string description() const override { if (fExpression) { return "return " + fExpression->description() + ";"; } else { - return SkString("return;"); + return "return;"; } } diff --git a/src/sksl/ir/SkSLSwizzle.h b/src/sksl/ir/SkSLSwizzle.h index c9397aec7f..0eb4a00dca 100644 --- a/src/sksl/ir/SkSLSwizzle.h +++ b/src/sksl/ir/SkSLSwizzle.h @@ -68,8 +68,8 @@ struct Swizzle : public Expression { ASSERT(fComponents.size() >= 1 && fComponents.size() <= 4); } - SkString description() const override { - SkString result = fBase->description() + "."; + std::string description() const override { + std::string result = fBase->description() + "."; for (int x : fComponents) { result += "xyzw"[x]; } diff --git a/src/sksl/ir/SkSLSymbol.h b/src/sksl/ir/SkSLSymbol.h index 10dcaf9344..d736516bc4 100644 --- a/src/sksl/ir/SkSLSymbol.h +++ b/src/sksl/ir/SkSLSymbol.h @@ -24,13 +24,13 @@ struct Symbol : public IRNode { kField_Kind }; - Symbol(Position position, Kind kind, SkString name) + Symbol(Position position, Kind kind, std::string name) : INHERITED(position) , fKind(kind) , fName(std::move(name)) {} const Kind fKind; - const SkString fName; + const std::string fName; typedef IRNode INHERITED; }; diff --git a/src/sksl/ir/SkSLSymbolTable.cpp b/src/sksl/ir/SkSLSymbolTable.cpp index 3ceeab91b0..6d8e9a7ea6 100644 --- a/src/sksl/ir/SkSLSymbolTable.cpp +++ b/src/sksl/ir/SkSLSymbolTable.cpp @@ -21,7 +21,7 @@ std::vector<const FunctionDeclaration*> SymbolTable::GetFunctions(const Symbol& } } -const Symbol* SymbolTable::operator[](const SkString& name) { +const Symbol* SymbolTable::operator[](const std::string& name) { const auto& entry = fSymbols.find(name); if (entry == fSymbols.end()) { if (fParent) { @@ -64,12 +64,12 @@ Symbol* SymbolTable::takeOwnership(Symbol* s) { return s; } -void SymbolTable::add(const SkString& name, std::unique_ptr<Symbol> symbol) { +void SymbolTable::add(const std::string& name, std::unique_ptr<Symbol> symbol) { this->addWithoutOwnership(name, symbol.get()); fOwnedPointers.push_back(std::move(symbol)); } -void SymbolTable::addWithoutOwnership(const SkString& name, const Symbol* symbol) { +void SymbolTable::addWithoutOwnership(const std::string& name, const Symbol* symbol) { const auto& existing = fSymbols.find(name); if (existing == fSymbols.end()) { fSymbols[name] = symbol; diff --git a/src/sksl/ir/SkSLSymbolTable.h b/src/sksl/ir/SkSLSymbolTable.h index df8dc713ae..be2b49c48d 100644 --- a/src/sksl/ir/SkSLSymbolTable.h +++ b/src/sksl/ir/SkSLSymbolTable.h @@ -31,11 +31,11 @@ public: : fParent(parent) , fErrorReporter(errorReporter) {} - const Symbol* operator[](const SkString& name); + const Symbol* operator[](const std::string& name); - void add(const SkString& name, std::unique_ptr<Symbol> symbol); + void add(const std::string& name, std::unique_ptr<Symbol> symbol); - void addWithoutOwnership(const SkString& name, const Symbol* symbol); + void addWithoutOwnership(const std::string& name, const Symbol* symbol); Symbol* takeOwnership(Symbol* s); @@ -48,7 +48,7 @@ private: std::vector<std::unique_ptr<Symbol>> fOwnedPointers; - std::unordered_map<SkString, const Symbol*> fSymbols; + std::unordered_map<std::string, const Symbol*> fSymbols; ErrorReporter& fErrorReporter; }; diff --git a/src/sksl/ir/SkSLTernaryExpression.h b/src/sksl/ir/SkSLTernaryExpression.h index 4a352536e3..bfaf304e55 100644 --- a/src/sksl/ir/SkSLTernaryExpression.h +++ b/src/sksl/ir/SkSLTernaryExpression.h @@ -26,7 +26,7 @@ struct TernaryExpression : public Expression { ASSERT(fIfTrue->fType == fIfFalse->fType); } - SkString description() const override { + std::string description() const override { return "(" + fTest->description() + " ? " + fIfTrue->description() + " : " + fIfFalse->description() + ")"; } diff --git a/src/sksl/ir/SkSLType.h b/src/sksl/ir/SkSLType.h index 4174c72a33..afd00d8b2a 100644 --- a/src/sksl/ir/SkSLType.h +++ b/src/sksl/ir/SkSLType.h @@ -26,17 +26,17 @@ class Context; class Type : public Symbol { public: struct Field { - Field(Modifiers modifiers, SkString name, const Type* type) + Field(Modifiers modifiers, std::string name, const Type* type) : fModifiers(modifiers) , fName(std::move(name)) , fType(std::move(type)) {} - const SkString description() const { + const std::string description() const { return fType->description() + " " + fName + ";"; } Modifiers fModifiers; - SkString fName; + std::string fName; const Type* fType; }; @@ -53,14 +53,14 @@ public: // Create an "other" (special) type with the given name. These types cannot be directly // referenced from user code. - Type(SkString name) + Type(std::string name) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kOther_Kind) {} // Create a generic type which maps to the listed types. As currently implemented, there are // always exactly four coercion targets, mapping to the scalar, vec2, vec3, and vec4 versions of // a type. - Type(SkString name, std::vector<const Type*> types) + Type(std::string name, std::vector<const Type*> types) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kGeneric_Kind) , fCoercibleTypes(std::move(types)) { @@ -68,13 +68,13 @@ public: } // Create a struct type with the given fields. - Type(SkString name, std::vector<Field> fields) + Type(std::string name, std::vector<Field> fields) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kStruct_Kind) , fFields(std::move(fields)) {} // Create a scalar type. - Type(SkString name, bool isNumber) + Type(std::string name, bool isNumber) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kScalar_Kind) , fIsNumber(isNumber) @@ -82,7 +82,7 @@ public: , fRows(1) {} // Create a scalar type which can be coerced to the listed types. - Type(SkString name, bool isNumber, std::vector<const Type*> coercibleTypes) + Type(std::string name, bool isNumber, std::vector<const Type*> coercibleTypes) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kScalar_Kind) , fIsNumber(isNumber) @@ -91,11 +91,11 @@ public: , fRows(1) {} // Create a vector type. - Type(SkString name, const Type& componentType, int columns) + Type(std::string name, const Type& componentType, int columns) : Type(name, kVector_Kind, componentType, columns) {} // Create a vector or array type. - Type(SkString name, Kind kind, const Type& componentType, int columns) + Type(std::string name, Kind kind, const Type& componentType, int columns) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kind) , fComponentType(&componentType) @@ -104,7 +104,7 @@ public: , fDimensions(SpvDim1D) {} // Create a matrix type. - Type(SkString name, const Type& componentType, int columns, int rows) + Type(std::string name, const Type& componentType, int columns, int rows) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kMatrix_Kind) , fComponentType(&componentType) @@ -113,7 +113,7 @@ public: , fDimensions(SpvDim1D) {} // Create a sampler type. - Type(SkString name, SpvDim_ dimensions, bool isDepth, bool isArrayed, bool isMultisampled, + Type(std::string name, SpvDim_ dimensions, bool isDepth, bool isArrayed, bool isMultisampled, bool isSampled) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kSampler_Kind) @@ -123,11 +123,11 @@ public: , fIsMultisampled(isMultisampled) , fIsSampled(isSampled) {} - SkString name() const { + std::string name() const { return fName; } - SkString description() const override { + std::string description() const override { return fName; } diff --git a/src/sksl/ir/SkSLTypeReference.h b/src/sksl/ir/SkSLTypeReference.h index 1c6f16ce58..67e0466763 100644 --- a/src/sksl/ir/SkSLTypeReference.h +++ b/src/sksl/ir/SkSLTypeReference.h @@ -22,7 +22,7 @@ struct TypeReference : public Expression { : INHERITED(position, kTypeReference_Kind, *context.fInvalid_Type) , fValue(type) {} - SkString description() const override { + std::string description() const override { return fValue.name(); } diff --git a/src/sksl/ir/SkSLUnresolvedFunction.h b/src/sksl/ir/SkSLUnresolvedFunction.h index 76741cfca8..7e8a3601e8 100644 --- a/src/sksl/ir/SkSLUnresolvedFunction.h +++ b/src/sksl/ir/SkSLUnresolvedFunction.h @@ -26,7 +26,7 @@ struct UnresolvedFunction : public Symbol { #endif } - virtual SkString description() const override { + virtual std::string description() const override { return fName; } diff --git a/src/sksl/ir/SkSLVarDeclarations.h b/src/sksl/ir/SkSLVarDeclarations.h index 295c0b6997..e64a874d69 100644 --- a/src/sksl/ir/SkSLVarDeclarations.h +++ b/src/sksl/ir/SkSLVarDeclarations.h @@ -27,8 +27,8 @@ struct VarDeclaration { , fSizes(std::move(sizes)) , fValue(std::move(value)) {} - SkString description() const { - SkString result = fVar->fName; + std::string description() const { + std::string result = fVar->fName; for (const auto& size : fSizes) { if (size) { result += "[" + size->description() + "]"; @@ -57,12 +57,13 @@ struct VarDeclarations : public ProgramElement { , fBaseType(*baseType) , fVars(std::move(vars)) {} - SkString description() const override { + std::string description() const override { if (!fVars.size()) { - return SkString(); + return ""; } - SkString result = fVars[0].fVar->fModifiers.description() + fBaseType.description() + " "; - SkString separator; + std::string result = fVars[0].fVar->fModifiers.description() + fBaseType.description() + + " "; + std::string separator = ""; for (const auto& var : fVars) { result += separator; separator = ", "; diff --git a/src/sksl/ir/SkSLVarDeclarationsStatement.h b/src/sksl/ir/SkSLVarDeclarationsStatement.h index 7a29656593..0b62edb866 100644 --- a/src/sksl/ir/SkSLVarDeclarationsStatement.h +++ b/src/sksl/ir/SkSLVarDeclarationsStatement.h @@ -21,7 +21,7 @@ struct VarDeclarationsStatement : public Statement { : INHERITED(decl->fPosition, kVarDeclarations_Kind) , fDeclaration(std::move(decl)) {} - SkString description() const override { + std::string description() const override { return fDeclaration->description(); } diff --git a/src/sksl/ir/SkSLVariable.h b/src/sksl/ir/SkSLVariable.h index 39b8482a7b..217b1006b6 100644 --- a/src/sksl/ir/SkSLVariable.h +++ b/src/sksl/ir/SkSLVariable.h @@ -27,7 +27,7 @@ struct Variable : public Symbol { kParameter_Storage }; - Variable(Position position, Modifiers modifiers, SkString name, const Type& type, + Variable(Position position, Modifiers modifiers, std::string name, const Type& type, Storage storage) : INHERITED(position, kVariable_Kind, std::move(name)) , fModifiers(modifiers) @@ -36,7 +36,7 @@ struct Variable : public Symbol { , fIsReadFrom(false) , fIsWrittenTo(false) {} - virtual SkString description() const override { + virtual std::string description() const override { return fModifiers.description() + fType.fName + " " + fName; } diff --git a/src/sksl/ir/SkSLVariableReference.h b/src/sksl/ir/SkSLVariableReference.h index c6a2ea0511..b443da1f22 100644 --- a/src/sksl/ir/SkSLVariableReference.h +++ b/src/sksl/ir/SkSLVariableReference.h @@ -24,7 +24,7 @@ struct VariableReference : public Expression { : INHERITED(position, kVariableReference_Kind, variable.fType) , fVariable(variable) {} - SkString description() const override { + std::string description() const override { return fVariable.fName; } diff --git a/src/sksl/ir/SkSLWhileStatement.h b/src/sksl/ir/SkSLWhileStatement.h index 7c6a2907c4..1acb572583 100644 --- a/src/sksl/ir/SkSLWhileStatement.h +++ b/src/sksl/ir/SkSLWhileStatement.h @@ -23,7 +23,7 @@ struct WhileStatement : public Statement { , fTest(std::move(test)) , fStatement(std::move(statement)) {} - SkString description() const override { + std::string description() const override { return "while (" + fTest->description() + ") " + fStatement->description(); } |