From f3333c89bf05fc602d9bf8e1e24547668c660383 Mon Sep 17 00:00:00 2001 From: Ethan Nicholas Date: Fri, 31 Mar 2017 09:33:41 -0400 Subject: skslc can now be compiled with no Skia dependencies, in preparation for its eventual role in Skia's build process. This reverts commit bcf35f86d50b784b165de703b404998dd4299f6a. BUG=skia: Change-Id: Id0a12dfc4d804d69a3c6bf60fed37e89ee130f02 Reviewed-on: https://skia-review.googlesource.com/10802 Commit-Queue: Ethan Nicholas Reviewed-by: Ben Wagner --- src/sksl/ir/SkSLBinaryExpression.h | 2 +- src/sksl/ir/SkSLBlock.h | 4 ++-- src/sksl/ir/SkSLBoolLiteral.h | 6 +++--- src/sksl/ir/SkSLBreakStatement.h | 8 ++++---- src/sksl/ir/SkSLConstructor.h | 6 +++--- src/sksl/ir/SkSLContinueStatement.h | 8 ++++---- src/sksl/ir/SkSLDiscardStatement.h | 8 ++++---- src/sksl/ir/SkSLDoStatement.h | 4 ++-- src/sksl/ir/SkSLExpressionStatement.h | 6 +++--- src/sksl/ir/SkSLExtension.h | 14 +++++++------- src/sksl/ir/SkSLField.h | 10 +++++----- src/sksl/ir/SkSLFieldAccess.h | 6 +++--- src/sksl/ir/SkSLFloatLiteral.h | 4 ++-- src/sksl/ir/SkSLForStatement.h | 14 +++++++------- src/sksl/ir/SkSLFunctionCall.h | 8 ++++---- src/sksl/ir/SkSLFunctionDeclaration.h | 12 ++++++------ src/sksl/ir/SkSLFunctionDefinition.h | 6 +++--- src/sksl/ir/SkSLFunctionReference.h | 10 +++++----- src/sksl/ir/SkSLIRNode.h | 6 +++--- src/sksl/ir/SkSLIfStatement.h | 8 ++++---- src/sksl/ir/SkSLIndexExpression.h | 6 +++--- src/sksl/ir/SkSLIntLiteral.h | 4 ++-- src/sksl/ir/SkSLInterfaceBlock.h | 12 ++++++------ src/sksl/ir/SkSLLayout.h | 11 +++++------ src/sksl/ir/SkSLModifiers.h | 4 ++-- src/sksl/ir/SkSLModifiersDeclaration.h | 4 ++-- src/sksl/ir/SkSLPostfixExpression.h | 4 ++-- src/sksl/ir/SkSLPrefixExpression.h | 4 ++-- src/sksl/ir/SkSLProgram.h | 4 ++++ src/sksl/ir/SkSLProgramElement.h | 2 +- src/sksl/ir/SkSLReturnStatement.h | 8 ++++---- src/sksl/ir/SkSLStatement.h | 2 +- src/sksl/ir/SkSLSwitchCase.h | 4 ++-- src/sksl/ir/SkSLSwitchStatement.h | 4 ++-- src/sksl/ir/SkSLSwizzle.h | 8 ++++---- src/sksl/ir/SkSLSymbol.h | 6 +++--- src/sksl/ir/SkSLSymbolTable.cpp | 6 +++--- src/sksl/ir/SkSLSymbolTable.h | 10 +++++----- src/sksl/ir/SkSLTernaryExpression.h | 6 +++--- src/sksl/ir/SkSLType.cpp | 4 ++-- src/sksl/ir/SkSLType.h | 28 ++++++++++++++-------------- src/sksl/ir/SkSLTypeReference.h | 6 +++--- src/sksl/ir/SkSLUnresolvedFunction.h | 4 ++-- src/sksl/ir/SkSLVarDeclarations.h | 20 ++++++++++---------- src/sksl/ir/SkSLVarDeclarationsStatement.h | 4 ++-- src/sksl/ir/SkSLVariable.h | 6 +++--- src/sksl/ir/SkSLVariableReference.h | 4 ++-- src/sksl/ir/SkSLWhileStatement.h | 6 +++--- 48 files changed, 172 insertions(+), 169 deletions(-) (limited to 'src/sksl/ir') diff --git a/src/sksl/ir/SkSLBinaryExpression.h b/src/sksl/ir/SkSLBinaryExpression.h index de85e4812b..73b1829ef2 100644 --- a/src/sksl/ir/SkSLBinaryExpression.h +++ b/src/sksl/ir/SkSLBinaryExpression.h @@ -34,7 +34,7 @@ struct BinaryExpression : public Expression { *fRight); } - virtual SkString description() const override { + virtual 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 17970fd561..fe58d44135 100644 --- a/src/sksl/ir/SkSLBlock.h +++ b/src/sksl/ir/SkSLBlock.h @@ -23,8 +23,8 @@ struct Block : public Statement { , fSymbols(std::move(symbols)) , fStatements(std::move(statements)) {} - SkString description() const override { - SkString result("{"); + String description() const override { + String result("{"); for (size_t i = 0; i < fStatements.size(); i++) { result += "\n"; result += fStatements[i]->description(); diff --git a/src/sksl/ir/SkSLBoolLiteral.h b/src/sksl/ir/SkSLBoolLiteral.h index b372f2f3ff..4e1e050778 100644 --- a/src/sksl/ir/SkSLBoolLiteral.h +++ b/src/sksl/ir/SkSLBoolLiteral.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_BOOLLITERAL #define SKSL_BOOLLITERAL @@ -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"); + String description() const override { + return String(fValue ? "true" : "false"); } bool isConstant() const override { diff --git a/src/sksl/ir/SkSLBreakStatement.h b/src/sksl/ir/SkSLBreakStatement.h index cd633c7a91..f6edc558e5 100644 --- a/src/sksl/ir/SkSLBreakStatement.h +++ b/src/sksl/ir/SkSLBreakStatement.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_BREAKSTATEMENT #define SKSL_BREAKSTATEMENT @@ -14,14 +14,14 @@ namespace SkSL { /** - * A 'break' statement. + * A 'break' statement. */ struct BreakStatement : public Statement { BreakStatement(Position position) : INHERITED(position, kBreak_Kind) {} - SkString description() const override { - return SkString("break;"); + String description() const override { + return String("break;"); } typedef Statement INHERITED; diff --git a/src/sksl/ir/SkSLConstructor.h b/src/sksl/ir/SkSLConstructor.h index 3360ace78e..5c647c7cab 100644 --- a/src/sksl/ir/SkSLConstructor.h +++ b/src/sksl/ir/SkSLConstructor.h @@ -44,9 +44,9 @@ struct Constructor : public Expression { return nullptr; } - SkString description() const override { - SkString result = fType.description() + "("; - SkString separator; + String description() const override { + String result = fType.description() + "("; + 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..3f5bc1d4bb 100644 --- a/src/sksl/ir/SkSLContinueStatement.h +++ b/src/sksl/ir/SkSLContinueStatement.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_CONTINUESTATEMENT #define SKSL_CONTINUESTATEMENT @@ -14,14 +14,14 @@ namespace SkSL { /** - * A 'continue' statement. + * A 'continue' statement. */ struct ContinueStatement : public Statement { ContinueStatement(Position position) : INHERITED(position, kContinue_Kind) {} - SkString description() const override { - return SkString("continue;"); + String description() const override { + return String("continue;"); } typedef Statement INHERITED; diff --git a/src/sksl/ir/SkSLDiscardStatement.h b/src/sksl/ir/SkSLDiscardStatement.h index 3ab6b27047..62124668ee 100644 --- a/src/sksl/ir/SkSLDiscardStatement.h +++ b/src/sksl/ir/SkSLDiscardStatement.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_DISCARDSTATEMENT #define SKSL_DISCARDSTATEMENT @@ -14,14 +14,14 @@ namespace SkSL { /** - * A 'discard' statement. + * A 'discard' statement. */ struct DiscardStatement : public Statement { DiscardStatement(Position position) : INHERITED(position, kDiscard_Kind) {} - SkString description() const override { - return SkString("discard;"); + String description() const override { + return String("discard;"); } typedef Statement INHERITED; diff --git a/src/sksl/ir/SkSLDoStatement.h b/src/sksl/ir/SkSLDoStatement.h index e26d3dc974..4d3d34864d 100644 --- a/src/sksl/ir/SkSLDoStatement.h +++ b/src/sksl/ir/SkSLDoStatement.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_DOSTATEMENT #define SKSL_DOSTATEMENT @@ -23,7 +23,7 @@ struct DoStatement : public Statement { , fStatement(std::move(statement)) , fTest(std::move(test)) {} - SkString description() const override { + 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 088b1c9ad1..d1ab8e9ed9 100644 --- a/src/sksl/ir/SkSLExpressionStatement.h +++ b/src/sksl/ir/SkSLExpressionStatement.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_EXPRESSIONSTATEMENT #define SKSL_EXPRESSIONSTATEMENT @@ -14,14 +14,14 @@ namespace SkSL { /** - * A lone expression being used as a statement. + * A lone expression being used as a statement. */ struct ExpressionStatement : public Statement { ExpressionStatement(std::unique_ptr expression) : INHERITED(expression->fPosition, kExpression_Kind) , fExpression(std::move(expression)) {} - SkString description() const override { + String description() const override { return fExpression->description() + ";"; } diff --git a/src/sksl/ir/SkSLExtension.h b/src/sksl/ir/SkSLExtension.h index ea5e0445e3..70dc6b3eaf 100644 --- a/src/sksl/ir/SkSLExtension.h +++ b/src/sksl/ir/SkSLExtension.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_EXTENSION #define SKSL_EXTENSION @@ -12,19 +12,19 @@ namespace SkSL { -/** - * An extension declaration. +/** + * An extension declaration. */ struct Extension : public ProgramElement { - Extension(Position position, SkString name) - : INHERITED(position, kExtension_Kind) + Extension(Position position, String name) + : INHERITED(position, kExtension_Kind) , fName(std::move(name)) {} - SkString description() const override { + String description() const override { return "#extension " + fName + " : enable"; } - const SkString fName; + const String fName; typedef ProgramElement INHERITED; }; diff --git a/src/sksl/ir/SkSLField.h b/src/sksl/ir/SkSLField.h index 53d85e0d5b..abea730da1 100644 --- a/src/sksl/ir/SkSLField.h +++ b/src/sksl/ir/SkSLField.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_FIELD #define SKSL_FIELD @@ -16,9 +16,9 @@ namespace SkSL { -/** - * A symbol which should be interpreted as a field access. Fields are added to the symboltable - * whenever a bare reference to an identifier should refer to a struct field; in GLSL, this is the +/** + * A symbol which should be interpreted as a field access. Fields are added to the symboltable + * whenever a bare reference to an identifier should refer to a struct field; in GLSL, this is the * result of declaring anonymous interface blocks. */ struct Field : public Symbol { @@ -27,7 +27,7 @@ struct Field : public Symbol { , fOwner(owner) , fFieldIndex(fieldIndex) {} - virtual SkString description() const override { + virtual 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 de26a3f626..eead41c71f 100644 --- a/src/sksl/ir/SkSLFieldAccess.h +++ b/src/sksl/ir/SkSLFieldAccess.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_FIELDACCESS #define SKSL_FIELDACCESS @@ -24,14 +24,14 @@ struct FieldAccess : public Expression { kAnonymousInterfaceBlock_OwnerKind }; - FieldAccess(std::unique_ptr base, int fieldIndex, + FieldAccess(std::unique_ptr base, int fieldIndex, OwnerKind ownerKind = kDefault_OwnerKind) : INHERITED(base->fPosition, kFieldAccess_Kind, *base->fType.fields()[fieldIndex].fType) , fBase(std::move(base)) , fFieldIndex(fieldIndex) , fOwnerKind(ownerKind) {} - virtual SkString description() const override { + virtual 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..5ed123575b 100644 --- a/src/sksl/ir/SkSLFloatLiteral.h +++ b/src/sksl/ir/SkSLFloatLiteral.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_FLOATLITERAL #define SKSL_FLOATLITERAL @@ -21,7 +21,7 @@ struct FloatLiteral : public Expression { : INHERITED(position, kFloatLiteral_Kind, *context.fFloat_Type) , fValue(value) {} - virtual SkString description() const override { + virtual String description() const override { return to_string(fValue); } diff --git a/src/sksl/ir/SkSLForStatement.h b/src/sksl/ir/SkSLForStatement.h index f2bf880ddd..b72c26b179 100644 --- a/src/sksl/ir/SkSLForStatement.h +++ b/src/sksl/ir/SkSLForStatement.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_FORSTATEMENT #define SKSL_FORSTATEMENT @@ -18,8 +18,8 @@ namespace SkSL { * A 'for' statement. */ struct ForStatement : public Statement { - ForStatement(Position position, std::unique_ptr initializer, - std::unique_ptr test, std::unique_ptr next, + ForStatement(Position position, std::unique_ptr initializer, + std::unique_ptr test, std::unique_ptr next, std::unique_ptr statement, std::shared_ptr symbols) : INHERITED(position, kFor_Kind) , fSymbols(symbols) @@ -28,15 +28,15 @@ struct ForStatement : public Statement { , fNext(std::move(next)) , fStatement(std::move(statement)) {} - SkString description() const override { - SkString result("for ("); + String description() const override { + String result("for ("); if (fInitializer) { result += fInitializer->description(); - } + } result += " "; if (fTest) { result += fTest->description(); - } + } result += "; "; if (fNext) { result += fNext->description(); diff --git a/src/sksl/ir/SkSLFunctionCall.h b/src/sksl/ir/SkSLFunctionCall.h index 1838076796..1a5c6fd693 100644 --- a/src/sksl/ir/SkSLFunctionCall.h +++ b/src/sksl/ir/SkSLFunctionCall.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_FUNCTIONCALL #define SKSL_FUNCTIONCALL @@ -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; + String description() const override { + String result = fFunction.fName + "("; + 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..05ba03addb 100644 --- a/src/sksl/ir/SkSLFunctionDeclaration.h +++ b/src/sksl/ir/SkSLFunctionDeclaration.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_FUNCTIONDECLARATION #define SKSL_FUNCTIONDECLARATION @@ -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, String name, std::vector 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; + String description() const override { + String result = fReturnType.description() + " " + fName + "("; + String separator; for (auto p : fParameters) { result += separator; separator = ", "; @@ -58,7 +58,7 @@ struct FunctionDeclaration : public Symbol { /** * Determine the effective types of this function's parameters and return value when called with - * the given arguments. This is relevant for functions with generic parameter types, where this + * the given arguments. This is relevant for functions with generic parameter types, where this * will collapse the generic types down into specific concrete types. * * Returns true if it was able to select a concrete set of types for the generic function, false diff --git a/src/sksl/ir/SkSLFunctionDefinition.h b/src/sksl/ir/SkSLFunctionDefinition.h index bae882525a..e87ee63e7a 100644 --- a/src/sksl/ir/SkSLFunctionDefinition.h +++ b/src/sksl/ir/SkSLFunctionDefinition.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_FUNCTIONDEFINITION #define SKSL_FUNCTIONDEFINITION @@ -18,13 +18,13 @@ namespace SkSL { * A function definition (a declaration plus an associated block of code). */ struct FunctionDefinition : public ProgramElement { - FunctionDefinition(Position position, const FunctionDeclaration& declaration, + FunctionDefinition(Position position, const FunctionDeclaration& declaration, std::unique_ptr body) : INHERITED(position, kFunction_Kind) , fDeclaration(declaration) , fBody(std::move(body)) {} - SkString description() const override { + String description() const override { return fDeclaration.description() + " " + fBody->description(); } diff --git a/src/sksl/ir/SkSLFunctionReference.h b/src/sksl/ir/SkSLFunctionReference.h index e95833d6e6..49ddf839f9 100644 --- a/src/sksl/ir/SkSLFunctionReference.h +++ b/src/sksl/ir/SkSLFunctionReference.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_FUNCTIONREFERENCE #define SKSL_FUNCTIONREFERENCE @@ -15,18 +15,18 @@ namespace SkSL { /** - * An identifier referring to a function name. This is an intermediate value: FunctionReferences are + * An identifier referring to a function name. This is an intermediate value: FunctionReferences are * always eventually replaced by FunctionCalls in valid programs. */ struct FunctionReference : public Expression { - FunctionReference(const Context& context, Position position, + FunctionReference(const Context& context, Position position, std::vector function) : INHERITED(position, kFunctionReference_Kind, *context.fInvalid_Type) , fFunctions(function) {} - virtual SkString description() const override { + virtual String description() const override { ASSERT(false); - return SkString(""); + return String(""); } const std::vector fFunctions; diff --git a/src/sksl/ir/SkSLIRNode.h b/src/sksl/ir/SkSLIRNode.h index 9a04cddec5..139be32f44 100644 --- a/src/sksl/ir/SkSLIRNode.h +++ b/src/sksl/ir/SkSLIRNode.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_IRNODE #define SKSL_IRNODE @@ -13,7 +13,7 @@ namespace SkSL { /** - * Represents a node in the intermediate representation (IR) tree. The IR is a fully-resolved + * Represents a node in the intermediate representation (IR) tree. The IR is a fully-resolved * version of the program (all types determined, everything validated), ready for code generation. */ struct IRNode { @@ -22,7 +22,7 @@ struct IRNode { virtual ~IRNode() {} - virtual SkString description() const = 0; + virtual String description() const = 0; const Position fPosition; }; diff --git a/src/sksl/ir/SkSLIfStatement.h b/src/sksl/ir/SkSLIfStatement.h index 8667e932ec..a7e0aad00e 100644 --- a/src/sksl/ir/SkSLIfStatement.h +++ b/src/sksl/ir/SkSLIfStatement.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_IFSTATEMENT #define SKSL_IFSTATEMENT @@ -17,15 +17,15 @@ namespace SkSL { * An 'if' statement. */ struct IfStatement : public Statement { - IfStatement(Position position, std::unique_ptr test, + IfStatement(Position position, std::unique_ptr test, std::unique_ptr ifTrue, std::unique_ptr ifFalse) : INHERITED(position, kIf_Kind) , fTest(std::move(test)) , fIfTrue(std::move(ifTrue)) , fIfFalse(std::move(ifFalse)) {} - SkString description() const override { - SkString result = "if (" + fTest->description() + ") " + fIfTrue->description(); + String description() const override { + 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 d255c7daf6..68823bf184 100644 --- a/src/sksl/ir/SkSLIndexExpression.h +++ b/src/sksl/ir/SkSLIndexExpression.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_INDEX #define SKSL_INDEX @@ -43,7 +43,7 @@ static const Type& index_type(const Context& context, const Type& type) { * An expression which extracts a value from an array or matrix, as in 'm[2]'. */ struct IndexExpression : public Expression { - IndexExpression(const Context& context, std::unique_ptr base, + IndexExpression(const Context& context, std::unique_ptr base, std::unique_ptr index) : INHERITED(base->fPosition, kIndex_Kind, index_type(context, base->fType)) , fBase(std::move(base)) @@ -51,7 +51,7 @@ struct IndexExpression : public Expression { ASSERT(fIndex->fType == *context.fInt_Type || fIndex->fType == *context.fUInt_Type); } - SkString description() const override { + String description() const override { return fBase->description() + "[" + fIndex->description() + "]"; } diff --git a/src/sksl/ir/SkSLIntLiteral.h b/src/sksl/ir/SkSLIntLiteral.h index b6a23d650c..2322a3d40a 100644 --- a/src/sksl/ir/SkSLIntLiteral.h +++ b/src/sksl/ir/SkSLIntLiteral.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_INTLITERAL #define SKSL_INTLITERAL @@ -23,7 +23,7 @@ struct IntLiteral : public Expression { : INHERITED(position, kIntLiteral_Kind, type ? *type : *context.fInt_Type) , fValue(value) {} - virtual SkString description() const override { + virtual String description() const override { return to_string(fValue); } diff --git a/src/sksl/ir/SkSLInterfaceBlock.h b/src/sksl/ir/SkSLInterfaceBlock.h index 0ec33e3d9c..fc6ccecc8d 100644 --- a/src/sksl/ir/SkSLInterfaceBlock.h +++ b/src/sksl/ir/SkSLInterfaceBlock.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_INTERFACEBLOCK #define SKSL_INTERFACEBLOCK @@ -25,7 +25,7 @@ namespace SkSL { * At the IR level, this is represented by a single variable of struct type. */ struct InterfaceBlock : public ProgramElement { - InterfaceBlock(Position position, const Variable* var, SkString typeName, SkString instanceName, + InterfaceBlock(Position position, const Variable* var, String typeName, String instanceName, std::vector> sizes, std::shared_ptr typeOwner) : INHERITED(position, kInterfaceBlock_Kind) @@ -35,8 +35,8 @@ struct InterfaceBlock : public ProgramElement { , fSizes(std::move(sizes)) , fTypeOwner(typeOwner) {} - SkString description() const override { - SkString result = fVariable.fModifiers.description() + fTypeName + " {\n"; + String description() const override { + String result = fVariable.fModifiers.description() + fTypeName + " {\n"; const Type* structType = &fVariable.fType; while (structType->kind() == Type::kArray_Kind) { structType = &structType->componentType(); @@ -59,8 +59,8 @@ struct InterfaceBlock : public ProgramElement { } const Variable& fVariable; - const SkString fTypeName; - const SkString fInstanceName; + const String fTypeName; + const String fInstanceName; const std::vector> fSizes; const std::shared_ptr fTypeOwner; diff --git a/src/sksl/ir/SkSLLayout.h b/src/sksl/ir/SkSLLayout.h index 5e7ec4486b..3a8416ac4e 100644 --- a/src/sksl/ir/SkSLLayout.h +++ b/src/sksl/ir/SkSLLayout.h @@ -8,7 +8,6 @@ #ifndef SKSL_LAYOUT #define SKSL_LAYOUT -#include "SkString.h" #include "SkSLUtil.h" namespace SkSL { @@ -55,11 +54,11 @@ struct Layout { case Format::kRGBA8I: return "rgba8i"; case Format::kR8I: return "r8i"; } - SkFAIL("Unexpected format"); + ABORT("Unexpected format"); return ""; } - static bool ReadFormat(SkString str, Format* format) { + static bool ReadFormat(String str, Format* format) { if (str == "rgba32f") { *format = Format::kRGBA32F; return true; @@ -125,9 +124,9 @@ struct Layout { , fMaxVertices(-1) , fInvocations(-1) {} - SkString description() const { - SkString result; - SkString separator; + String description() const { + String result; + String separator; if (fLocation >= 0) { result += separator + "location = " + to_string(fLocation); separator = ", "; diff --git a/src/sksl/ir/SkSLModifiers.h b/src/sksl/ir/SkSLModifiers.h index c7a563973e..9fae5b098c 100644 --- a/src/sksl/ir/SkSLModifiers.h +++ b/src/sksl/ir/SkSLModifiers.h @@ -42,8 +42,8 @@ struct Modifiers { : fLayout(layout) , fFlags(flags) {} - SkString description() const { - SkString result = fLayout.description(); + String description() const { + 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..a0ce74852d 100644 --- a/src/sksl/ir/SkSLModifiersDeclaration.h +++ b/src/sksl/ir/SkSLModifiersDeclaration.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_MODIFIERDECLARATION #define SKSL_MODIFIERDECLARATION @@ -23,7 +23,7 @@ struct ModifiersDeclaration : public ProgramElement { : INHERITED(Position(), kModifiers_Kind) , fModifiers(modifiers) {} - SkString description() const { + String description() const { return fModifiers.description() + ";"; } diff --git a/src/sksl/ir/SkSLPostfixExpression.h b/src/sksl/ir/SkSLPostfixExpression.h index 05ff1675e0..2c84af72fd 100644 --- a/src/sksl/ir/SkSLPostfixExpression.h +++ b/src/sksl/ir/SkSLPostfixExpression.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_POSTFIXEXPRESSION #define SKSL_POSTFIXEXPRESSION @@ -22,7 +22,7 @@ struct PostfixExpression : public Expression { , fOperand(std::move(operand)) , fOperator(op) {} - virtual SkString description() const override { + virtual 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 dafe1e9599..4fa54ca32d 100644 --- a/src/sksl/ir/SkSLPrefixExpression.h +++ b/src/sksl/ir/SkSLPrefixExpression.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_PREFIXEXPRESSION #define SKSL_PREFIXEXPRESSION @@ -22,7 +22,7 @@ struct PrefixExpression : public Expression { , fOperand(std::move(operand)) , fOperator(op) {} - virtual SkString description() const override { + virtual String description() const override { return Token::OperatorName(fOperator) + fOperand->description(); } diff --git a/src/sksl/ir/SkSLProgram.h b/src/sksl/ir/SkSLProgram.h index 2ca9372ec4..96bd5c4fbd 100644 --- a/src/sksl/ir/SkSLProgram.h +++ b/src/sksl/ir/SkSLProgram.h @@ -26,7 +26,11 @@ namespace SkSL { */ struct Program { struct Settings { +#ifdef SKSL_STANDALONE + const StandaloneShaderCaps* fCaps = &standaloneCaps; +#else const GrShaderCaps* fCaps = nullptr; +#endif // if false, sk_FragCoord is exactly the same as gl_FragCoord. If true, the y coordinate // must be flipped. bool fFlipY = false; diff --git a/src/sksl/ir/SkSLProgramElement.h b/src/sksl/ir/SkSLProgramElement.h index 2f1ce77199..ebb4e9a84d 100644 --- a/src/sksl/ir/SkSLProgramElement.h +++ b/src/sksl/ir/SkSLProgramElement.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_PROGRAMELEMENT #define SKSL_PROGRAMELEMENT diff --git a/src/sksl/ir/SkSLReturnStatement.h b/src/sksl/ir/SkSLReturnStatement.h index dc5ec9aa9c..841db94669 100644 --- a/src/sksl/ir/SkSLReturnStatement.h +++ b/src/sksl/ir/SkSLReturnStatement.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_RETURNSTATEMENT #define SKSL_RETURNSTATEMENT @@ -21,14 +21,14 @@ struct ReturnStatement : public Statement { : INHERITED(position, kReturn_Kind) {} ReturnStatement(std::unique_ptr expression) - : INHERITED(expression->fPosition, kReturn_Kind) + : INHERITED(expression->fPosition, kReturn_Kind) , fExpression(std::move(expression)) {} - SkString description() const override { + String description() const override { if (fExpression) { return "return " + fExpression->description() + ";"; } else { - return SkString("return;"); + return String("return;"); } } diff --git a/src/sksl/ir/SkSLStatement.h b/src/sksl/ir/SkSLStatement.h index c3a6f9539e..ba1a08772e 100644 --- a/src/sksl/ir/SkSLStatement.h +++ b/src/sksl/ir/SkSLStatement.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_STATEMENT #define SKSL_STATEMENT diff --git a/src/sksl/ir/SkSLSwitchCase.h b/src/sksl/ir/SkSLSwitchCase.h index 1fc2e852bc..8043f2e787 100644 --- a/src/sksl/ir/SkSLSwitchCase.h +++ b/src/sksl/ir/SkSLSwitchCase.h @@ -23,8 +23,8 @@ struct SwitchCase : public Statement { , fValue(std::move(value)) , fStatements(std::move(statements)) {} - SkString description() const override { - SkString result; + String description() const override { + String result; if (fValue) { result.appendf("case %s:\n", fValue->description().c_str()); } else { diff --git a/src/sksl/ir/SkSLSwitchStatement.h b/src/sksl/ir/SkSLSwitchStatement.h index 31765c4e04..88e1e70019 100644 --- a/src/sksl/ir/SkSLSwitchStatement.h +++ b/src/sksl/ir/SkSLSwitchStatement.h @@ -23,8 +23,8 @@ struct SwitchStatement : public Statement { , fValue(std::move(value)) , fCases(std::move(cases)) {} - SkString description() const override { - SkString result = SkStringPrintf("switch (%s) {\n", + fValue->description().c_str()); + String description() const override { + String result = String::printf("switch (%s) {\n", + fValue->description().c_str()); for (const auto& c : fCases) { result += c->description(); } diff --git a/src/sksl/ir/SkSLSwizzle.h b/src/sksl/ir/SkSLSwizzle.h index 0803f3bc36..1725ec2b5a 100644 --- a/src/sksl/ir/SkSLSwizzle.h +++ b/src/sksl/ir/SkSLSwizzle.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_SWIZZLE #define SKSL_SWIZZLE @@ -15,7 +15,7 @@ namespace SkSL { /** - * Given a type and a swizzle component count, returns the type that will result from swizzling. For + * Given a type and a swizzle component count, returns the type that will result from swizzling. For * instance, swizzling a vec3 with two components will result in a vec2. It is possible to swizzle * with more components than the source vector, as in 'vec2(1).xxxx'. */ @@ -69,8 +69,8 @@ struct Swizzle : public Expression { ASSERT(fComponents.size() >= 1 && fComponents.size() <= 4); } - SkString description() const override { - SkString result = fBase->description() + "."; + String description() const override { + 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..e883ea7555 100644 --- a/src/sksl/ir/SkSLSymbol.h +++ b/src/sksl/ir/SkSLSymbol.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_SYMBOL #define SKSL_SYMBOL @@ -24,13 +24,13 @@ struct Symbol : public IRNode { kField_Kind }; - Symbol(Position position, Kind kind, SkString name) + Symbol(Position position, Kind kind, String name) : INHERITED(position) , fKind(kind) , fName(std::move(name)) {} const Kind fKind; - const SkString fName; + const String fName; typedef IRNode INHERITED; }; diff --git a/src/sksl/ir/SkSLSymbolTable.cpp b/src/sksl/ir/SkSLSymbolTable.cpp index 3ceeab91b0..4d39e8bc9d 100644 --- a/src/sksl/ir/SkSLSymbolTable.cpp +++ b/src/sksl/ir/SkSLSymbolTable.cpp @@ -21,7 +21,7 @@ std::vector SymbolTable::GetFunctions(const Symbol& } } -const Symbol* SymbolTable::operator[](const SkString& name) { +const Symbol* SymbolTable::operator[](const 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) { +void SymbolTable::add(const String& name, std::unique_ptr 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 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 948a447b80..6bafef259d 100644 --- a/src/sksl/ir/SkSLSymbolTable.h +++ b/src/sksl/ir/SkSLSymbolTable.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_SYMBOLTABLE #define SKSL_SYMBOLTABLE @@ -31,11 +31,11 @@ public: : fParent(parent) , fErrorReporter(*errorReporter) {} - const Symbol* operator[](const SkString& name); + const Symbol* operator[](const String& name); - void add(const SkString& name, std::unique_ptr symbol); + void add(const String& name, std::unique_ptr symbol); - void addWithoutOwnership(const SkString& name, const Symbol* symbol); + void addWithoutOwnership(const String& name, const Symbol* symbol); Symbol* takeOwnership(Symbol* s); @@ -48,7 +48,7 @@ private: std::vector> fOwnedPointers; - std::unordered_map fSymbols; + std::unordered_map fSymbols; ErrorReporter& fErrorReporter; }; diff --git a/src/sksl/ir/SkSLTernaryExpression.h b/src/sksl/ir/SkSLTernaryExpression.h index 02750049d4..9fbac19c25 100644 --- a/src/sksl/ir/SkSLTernaryExpression.h +++ b/src/sksl/ir/SkSLTernaryExpression.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_TERNARYEXPRESSION #define SKSL_TERNARYEXPRESSION @@ -26,8 +26,8 @@ struct TernaryExpression : public Expression { ASSERT(fIfTrue->fType == fIfFalse->fType); } - SkString description() const override { - return "(" + fTest->description() + " ? " + fIfTrue->description() + " : " + + String description() const override { + return "(" + fTest->description() + " ? " + fIfTrue->description() + " : " + fIfFalse->description() + ")"; } diff --git a/src/sksl/ir/SkSLType.cpp b/src/sksl/ir/SkSLType.cpp index d28c4f0666..c919cbc8ae 100644 --- a/src/sksl/ir/SkSLType.cpp +++ b/src/sksl/ir/SkSLType.cpp @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ - + #include "SkSLType.h" #include "SkSLContext.h" @@ -22,7 +22,7 @@ bool Type::determineCoercionCost(const Type& other, int* outCost) const { return false; } if (this->kind() == kMatrix_Kind) { - if (this->columns() == other.columns() && + if (this->columns() == other.columns() && this->rows() == other.rows()) { return this->componentType().determineCoercionCost(other.componentType(), outCost); } diff --git a/src/sksl/ir/SkSLType.h b/src/sksl/ir/SkSLType.h index 2f98e53e62..44bc26272b 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, String name, const Type* type) : fModifiers(modifiers) , fName(std::move(name)) , fType(std::move(type)) {} - const SkString description() const { + const String description() const { return fType->description() + " " + fName + ";"; } Modifiers fModifiers; - SkString fName; + String fName; const Type* fType; }; @@ -53,24 +53,24 @@ public: // Create an "other" (special) type with the given name. These types cannot be directly // referenced from user code. - Type(SkString name) + Type(String name) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kOther_Kind) {} // Create a generic type which maps to the listed types. - Type(SkString name, std::vector types) + Type(String name, std::vector types) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kGeneric_Kind) , fCoercibleTypes(std::move(types)) {} // Create a struct type with the given fields. - Type(Position position, SkString name, std::vector fields) + Type(Position position, String name, std::vector 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(String name, bool isNumber) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kScalar_Kind) , fIsNumber(isNumber) @@ -78,7 +78,7 @@ public: , fRows(1) {} // Create a scalar type which can be coerced to the listed types. - Type(SkString name, bool isNumber, std::vector coercibleTypes) + Type(String name, bool isNumber, std::vector coercibleTypes) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kScalar_Kind) , fIsNumber(isNumber) @@ -87,11 +87,11 @@ public: , fRows(1) {} // Create a vector type. - Type(SkString name, const Type& componentType, int columns) + Type(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(String name, Kind kind, const Type& componentType, int columns) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kind) , fComponentType(&componentType) @@ -100,7 +100,7 @@ public: , fDimensions(SpvDim1D) {} // Create a matrix type. - Type(SkString name, const Type& componentType, int columns, int rows) + Type(String name, const Type& componentType, int columns, int rows) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kMatrix_Kind) , fComponentType(&componentType) @@ -109,7 +109,7 @@ public: , fDimensions(SpvDim1D) {} // Create a sampler type. - Type(SkString name, SpvDim_ dimensions, bool isDepth, bool isArrayed, bool isMultisampled, + Type(String name, SpvDim_ dimensions, bool isDepth, bool isArrayed, bool isMultisampled, bool isSampled) : INHERITED(Position(), kType_Kind, std::move(name)) , fTypeKind(kSampler_Kind) @@ -119,11 +119,11 @@ public: , fIsMultisampled(isMultisampled) , fIsSampled(isSampled) {} - SkString name() const { + String name() const { return fName; } - SkString description() const override { + String description() const override { return fName; } diff --git a/src/sksl/ir/SkSLTypeReference.h b/src/sksl/ir/SkSLTypeReference.h index 1c6f16ce58..b12c185ce2 100644 --- a/src/sksl/ir/SkSLTypeReference.h +++ b/src/sksl/ir/SkSLTypeReference.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_TYPEREFERENCE #define SKSL_TYPEREFERENCE @@ -14,7 +14,7 @@ namespace SkSL { /** - * Represents an identifier referring to a type. This is an intermediate value: TypeReferences are + * Represents an identifier referring to a type. This is an intermediate value: TypeReferences are * always eventually replaced by Constructors in valid programs. */ struct TypeReference : public Expression { @@ -22,7 +22,7 @@ struct TypeReference : public Expression { : INHERITED(position, kTypeReference_Kind, *context.fInvalid_Type) , fValue(type) {} - SkString description() const override { + String description() const override { return fValue.name(); } diff --git a/src/sksl/ir/SkSLUnresolvedFunction.h b/src/sksl/ir/SkSLUnresolvedFunction.h index 76741cfca8..c5fdbd0734 100644 --- a/src/sksl/ir/SkSLUnresolvedFunction.h +++ b/src/sksl/ir/SkSLUnresolvedFunction.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_UNRESOLVEDFUNCTION #define SKSL_UNRESOLVEDFUNCTION @@ -26,7 +26,7 @@ struct UnresolvedFunction : public Symbol { #endif } - virtual SkString description() const override { + virtual String description() const override { return fName; } diff --git a/src/sksl/ir/SkSLVarDeclarations.h b/src/sksl/ir/SkSLVarDeclarations.h index 5781230ece..5a006bd133 100644 --- a/src/sksl/ir/SkSLVarDeclarations.h +++ b/src/sksl/ir/SkSLVarDeclarations.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_VARDECLARATIONS #define SKSL_VARDECLARATIONS @@ -17,7 +17,7 @@ namespace SkSL { /** * A single variable declaration within a var declaration statement. For instance, the statement - * 'int x = 2, y[3];' is a VarDeclarations statement containing two individual VarDeclaration + * 'int x = 2, y[3];' is a VarDeclarations statement containing two individual VarDeclaration * instances. */ struct VarDeclaration { @@ -28,8 +28,8 @@ struct VarDeclaration { , fSizes(std::move(sizes)) , fValue(std::move(value)) {} - SkString description() const { - SkString result = fVar->fName; + String description() const { + String result = fVar->fName; for (const auto& size : fSizes) { if (size) { result += "[" + size->description() + "]"; @@ -40,7 +40,7 @@ struct VarDeclaration { if (fValue) { result += " = " + fValue->description(); } - return result; + return result; } const Variable* fVar; @@ -52,18 +52,18 @@ struct VarDeclaration { * A variable declaration statement, which may consist of one or more individual variables. */ struct VarDeclarations : public ProgramElement { - VarDeclarations(Position position, const Type* baseType, + VarDeclarations(Position position, const Type* baseType, std::vector vars) : INHERITED(position, kVar_Kind) , fBaseType(*baseType) , fVars(std::move(vars)) {} - SkString description() const override { + String description() const override { if (!fVars.size()) { - return SkString(); + return String(); } - SkString result = fVars[0].fVar->fModifiers.description() + fBaseType.description() + " "; - SkString separator; + String result = fVars[0].fVar->fModifiers.description() + fBaseType.description() + " "; + 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 66b570f853..50365decc1 100644 --- a/src/sksl/ir/SkSLVarDeclarationsStatement.h +++ b/src/sksl/ir/SkSLVarDeclarationsStatement.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_VARDECLARATIONSSTATEMENT #define SKSL_VARDECLARATIONSSTATEMENT @@ -21,7 +21,7 @@ struct VarDeclarationsStatement : public Statement { : INHERITED(decl->fPosition, kVarDeclarations_Kind) , fDeclaration(std::move(decl)) {} - SkString description() const override { + String description() const override { return fDeclaration->description(); } diff --git a/src/sksl/ir/SkSLVariable.h b/src/sksl/ir/SkSLVariable.h index 2c3391dfa2..21f17bad8e 100644 --- a/src/sksl/ir/SkSLVariable.h +++ b/src/sksl/ir/SkSLVariable.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_VARIABLE #define SKSL_VARIABLE @@ -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, String name, const Type& type, Storage storage) : INHERITED(position, kVariable_Kind, std::move(name)) , fModifiers(modifiers) @@ -36,7 +36,7 @@ struct Variable : public Symbol { , fReadCount(0) , fWriteCount(0) {} - virtual SkString description() const override { + virtual 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 7d90511590..af181f84fd 100644 --- a/src/sksl/ir/SkSLVariableReference.h +++ b/src/sksl/ir/SkSLVariableReference.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_VARIABLEREFERENCE #define SKSL_VARIABLEREFERENCE @@ -67,7 +67,7 @@ struct VariableReference : public Expression { fRefKind = refKind; } - SkString description() const override { + String description() const override { return fVariable.fName; } diff --git a/src/sksl/ir/SkSLWhileStatement.h b/src/sksl/ir/SkSLWhileStatement.h index a741a0441d..c35d6df9e4 100644 --- a/src/sksl/ir/SkSLWhileStatement.h +++ b/src/sksl/ir/SkSLWhileStatement.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_WHILESTATEMENT #define SKSL_WHILESTATEMENT @@ -17,13 +17,13 @@ namespace SkSL { * A 'while' loop. */ struct WhileStatement : public Statement { - WhileStatement(Position position, std::unique_ptr test, + WhileStatement(Position position, std::unique_ptr test, std::unique_ptr statement) : INHERITED(position, kWhile_Kind) , fTest(std::move(test)) , fStatement(std::move(statement)) {} - SkString description() const override { + String description() const override { return "while (" + fTest->description() + ") " + fStatement->description(); } -- cgit v1.2.3