changed various SkSL structs into classes
The goal is to have all of the IR structs be classes when the rearchitecture is complete. Some of these should have been changed in earlier CLs, and some of them never contained any data in the first place and thus won't be affected by the rearchitecture. Change-Id: Id5a3cebffd59a4c43b79f2195b50106ede7c2f87 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323882 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
b8cc665ffe
commit
1e9f7f36f7
@ -16,11 +16,11 @@
|
||||
namespace SkSL {
|
||||
|
||||
class ErrorReporter;
|
||||
struct Expression;
|
||||
class Expression;
|
||||
struct FunctionDefinition;
|
||||
struct Program;
|
||||
struct ProgramElement;
|
||||
struct Statement;
|
||||
class ProgramElement;
|
||||
class Statement;
|
||||
class Variable;
|
||||
struct VariableReference;
|
||||
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace SkSL {
|
||||
|
||||
struct Expression;
|
||||
struct ProgramElement;
|
||||
struct Statement;
|
||||
class Expression;
|
||||
class ProgramElement;
|
||||
class Statement;
|
||||
class Symbol;
|
||||
class SymbolTable;
|
||||
|
||||
|
@ -33,8 +33,8 @@
|
||||
|
||||
namespace SkSL {
|
||||
|
||||
class FunctionCall;
|
||||
struct Swizzle;
|
||||
struct FunctionCall;
|
||||
|
||||
/**
|
||||
* Intrinsics are passed between the Compiler and the IRGenerator using IRIntrinsicMaps.
|
||||
|
@ -18,13 +18,13 @@ namespace SkSL {
|
||||
|
||||
class Block;
|
||||
class Context;
|
||||
struct Expression;
|
||||
struct FunctionCall;
|
||||
class Expression;
|
||||
class FunctionCall;
|
||||
struct FunctionDefinition;
|
||||
struct InlineCandidate;
|
||||
struct InlineCandidateList;
|
||||
class ModifiersPool;
|
||||
struct Statement;
|
||||
class Statement;
|
||||
class SymbolTable;
|
||||
class Variable;
|
||||
|
||||
|
@ -19,10 +19,10 @@ namespace SkSL {
|
||||
|
||||
class Context;
|
||||
class ErrorReporter;
|
||||
struct Expression;
|
||||
class Expression;
|
||||
class IRGenerator;
|
||||
struct ProgramElement;
|
||||
struct Statement;
|
||||
class ProgramElement;
|
||||
class Statement;
|
||||
class SymbolTable;
|
||||
class Type;
|
||||
|
||||
|
@ -46,7 +46,8 @@ static inline bool check_ref(const Expression& expr) {
|
||||
/**
|
||||
* A binary operation.
|
||||
*/
|
||||
struct BinaryExpression : public Expression {
|
||||
class BinaryExpression : public Expression {
|
||||
public:
|
||||
static constexpr Kind kExpressionKind = Kind::kBinary;
|
||||
|
||||
BinaryExpression(int offset, std::unique_ptr<Expression> left, Token::Kind op,
|
||||
|
@ -16,7 +16,8 @@ namespace SkSL {
|
||||
/**
|
||||
* A 'break' statement.
|
||||
*/
|
||||
struct BreakStatement : public Statement {
|
||||
class BreakStatement : public Statement {
|
||||
public:
|
||||
static constexpr Kind kStatementKind = Kind::kBreak;
|
||||
|
||||
BreakStatement(int offset)
|
||||
@ -30,6 +31,7 @@ struct BreakStatement : public Statement {
|
||||
return String("break;");
|
||||
}
|
||||
|
||||
private:
|
||||
using INHERITED = Statement;
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,8 @@ namespace SkSL {
|
||||
/**
|
||||
* A 'continue' statement.
|
||||
*/
|
||||
struct ContinueStatement : public Statement {
|
||||
class ContinueStatement : public Statement {
|
||||
public:
|
||||
static constexpr Kind kStatementKind = Kind::kContinue;
|
||||
|
||||
ContinueStatement(int offset)
|
||||
@ -30,6 +31,7 @@ struct ContinueStatement : public Statement {
|
||||
return String("continue;");
|
||||
}
|
||||
|
||||
private:
|
||||
using INHERITED = Statement;
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,8 @@ namespace SkSL {
|
||||
/**
|
||||
* A 'discard' statement.
|
||||
*/
|
||||
struct DiscardStatement : public Statement {
|
||||
class DiscardStatement : public Statement {
|
||||
public:
|
||||
static constexpr Kind kStatementKind = Kind::kDiscard;
|
||||
|
||||
DiscardStatement(int offset)
|
||||
@ -30,6 +31,7 @@ struct DiscardStatement : public Statement {
|
||||
return String("discard;");
|
||||
}
|
||||
|
||||
private:
|
||||
using INHERITED = Statement;
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
namespace SkSL {
|
||||
|
||||
struct Expression;
|
||||
class Expression;
|
||||
class IRGenerator;
|
||||
class Variable;
|
||||
|
||||
@ -25,7 +25,8 @@ using DefinitionMap = TinyUnorderedMap<const Variable*, std::unique_ptr<Expressi
|
||||
/**
|
||||
* Abstract supertype of all expressions.
|
||||
*/
|
||||
struct Expression : public IRNode {
|
||||
class Expression : public IRNode {
|
||||
public:
|
||||
enum class Kind {
|
||||
kBinary = (int) Statement::Kind::kLast + 1,
|
||||
kBoolLiteral,
|
||||
@ -212,6 +213,7 @@ struct Expression : public IRNode {
|
||||
|
||||
virtual std::unique_ptr<Expression> clone() const = 0;
|
||||
|
||||
private:
|
||||
using INHERITED = IRNode;
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,8 @@ namespace SkSL {
|
||||
/**
|
||||
* An extension declaration.
|
||||
*/
|
||||
struct Extension : public ProgramElement {
|
||||
class Extension : public ProgramElement {
|
||||
public:
|
||||
static constexpr Kind kProgramElementKind = Kind::kExtension;
|
||||
|
||||
Extension(int offset, String name)
|
||||
@ -33,6 +34,7 @@ struct Extension : public ProgramElement {
|
||||
return "#extension " + this->name() + " : enable";
|
||||
}
|
||||
|
||||
private:
|
||||
using INHERITED = ProgramElement;
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,8 @@ namespace SkSL {
|
||||
/**
|
||||
* An external function invocation.
|
||||
*/
|
||||
struct ExternalFunctionCall : public Expression {
|
||||
class ExternalFunctionCall : public Expression {
|
||||
public:
|
||||
static constexpr Kind kExpressionKind = Kind::kExternalFunctionCall;
|
||||
|
||||
ExternalFunctionCall(int offset, const Type* type, const ExternalValue* function,
|
||||
|
@ -16,7 +16,8 @@ namespace SkSL {
|
||||
/**
|
||||
* A literal floating point number.
|
||||
*/
|
||||
struct FloatLiteral : public Expression {
|
||||
class FloatLiteral : public Expression {
|
||||
public:
|
||||
static constexpr Kind kExpressionKind = Kind::kFloatLiteral;
|
||||
|
||||
FloatLiteral(const Context& context, int offset, float value)
|
||||
|
@ -16,7 +16,8 @@ namespace SkSL {
|
||||
/**
|
||||
* A function invocation.
|
||||
*/
|
||||
struct FunctionCall : public Expression {
|
||||
class FunctionCall : public Expression {
|
||||
public:
|
||||
static constexpr Kind kExpressionKind = Kind::kFunctionCall;
|
||||
|
||||
FunctionCall(int offset, const Type* type, const FunctionDeclaration* function,
|
||||
@ -76,6 +77,7 @@ struct FunctionCall : public Expression {
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
using INHERITED = Expression;
|
||||
};
|
||||
|
||||
|
@ -18,10 +18,10 @@
|
||||
|
||||
namespace SkSL {
|
||||
|
||||
struct Expression;
|
||||
class Expression;
|
||||
class ExternalValue;
|
||||
struct FunctionDeclaration;
|
||||
struct Statement;
|
||||
class Statement;
|
||||
class Symbol;
|
||||
class SymbolTable;
|
||||
class Type;
|
||||
|
@ -17,7 +17,8 @@ namespace SkSL {
|
||||
/**
|
||||
* Represents a top-level element (e.g. function or global variable) in a program.
|
||||
*/
|
||||
struct ProgramElement : public IRNode {
|
||||
class ProgramElement : public IRNode {
|
||||
public:
|
||||
enum class Kind {
|
||||
kEnum = 0,
|
||||
kExtension,
|
||||
@ -74,6 +75,7 @@ struct ProgramElement : public IRNode {
|
||||
|
||||
virtual std::unique_ptr<ProgramElement> clone() const = 0;
|
||||
|
||||
private:
|
||||
using INHERITED = IRNode;
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,8 @@ namespace SkSL {
|
||||
/**
|
||||
* Abstract supertype of all statements.
|
||||
*/
|
||||
struct Statement : public IRNode {
|
||||
class Statement : public IRNode {
|
||||
public:
|
||||
enum Kind {
|
||||
kBlock = (int) Symbol::Kind::kLast + 1,
|
||||
kBreak,
|
||||
@ -88,6 +89,7 @@ struct Statement : public IRNode {
|
||||
|
||||
virtual std::unique_ptr<Statement> clone() const = 0;
|
||||
|
||||
private:
|
||||
using INHERITED = IRNode;
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
namespace SkSL {
|
||||
|
||||
struct Expression;
|
||||
class Expression;
|
||||
|
||||
/**
|
||||
* Represents a variable, whether local, global, or a function parameter. This represents the
|
||||
|
Loading…
Reference in New Issue
Block a user