@@ -296,7 +296,7 @@ std::unique_ptr<Block> IRGenerator::convertBlock(const ASTNode& block) {
296296
297297std::unique_ptr<Statement> IRGenerator::convertVarDeclarationStatement (const ASTNode& s) {
298298 SkASSERT (s.fKind == ASTNode::Kind::kVarDeclarations );
299- auto decls = this ->convertVarDeclarations (s, Variable::kLocal_Storage );
299+ auto decls = this ->convertVarDeclarations (s, Variable::Storage:: kLocal );
300300 if (decls.empty ()) {
301301 return nullptr ;
302302 }
@@ -320,7 +320,7 @@ std::vector<std::unique_ptr<Statement>> IRGenerator::convertVarDeclarations(
320320 return {};
321321 }
322322 if (baseType->nonnullable () == *fContext .fFragmentProcessor_Type &&
323- storage != Variable::kGlobal_Storage ) {
323+ storage != Variable::Storage:: kGlobal ) {
324324 fErrors .error (decls.fOffset ,
325325 " variables of type '" + baseType->displayName () + " ' must be global" );
326326 }
@@ -397,7 +397,7 @@ std::vector<std::unique_ptr<Statement>> IRGenerator::convertVarDeclarations(
397397 }
398398 }
399399 int permitted = Modifiers::kConst_Flag ;
400- if (storage == Variable::kGlobal_Storage ) {
400+ if (storage == Variable::Storage:: kGlobal ) {
401401 permitted |= Modifiers::kIn_Flag | Modifiers::kOut_Flag | Modifiers::kUniform_Flag |
402402 Modifiers::kFlat_Flag | Modifiers::kVarying_Flag |
403403 Modifiers::kNoPerspective_Flag | Modifiers::kPLS_Flag |
@@ -468,9 +468,9 @@ std::vector<std::unique_ptr<Statement>> IRGenerator::convertVarDeclarations(
468468 var->setInitialValue (value.get ());
469469 }
470470 Symbol* symbol = (*fSymbolTable )[var->name ()];
471- if (symbol && storage == Variable::kGlobal_Storage && var->name () == " sk_FragColor" ) {
471+ if (symbol && storage == Variable::Storage:: kGlobal && var->name () == " sk_FragColor" ) {
472472 // Already defined, ignore.
473- } else if (symbol && storage == Variable::kGlobal_Storage &&
473+ } else if (symbol && storage == Variable::Storage:: kGlobal &&
474474 symbol->kind () == Symbol::Kind::kVariable &&
475475 symbol->as <Variable>().modifiers ().fLayout .fBuiltin >= 0 ) {
476476 // Already defined, just update the modifiers.
@@ -789,9 +789,9 @@ std::unique_ptr<Block> IRGenerator::applyInvocationIDWorkaround(std::unique_ptr<
789789 fContext .fBool_Type .get ()));
790790 std::unique_ptr<Expression> next (new PostfixExpression (
791791 std::unique_ptr<Expression>(
792- new VariableReference (-1 ,
793- loopIdx,
794- VariableReference::kReadWrite_RefKind )),
792+ new VariableReference (-1 ,
793+ loopIdx,
794+ VariableReference::RefKind:: kReadWrite )),
795795 Token::Kind::TK_PLUSPLUS));
796796 ASTNode endPrimitiveID (&fFile ->fNodes , -1 , ASTNode::Kind::kIdentifier , " EndPrimitive" );
797797 std::unique_ptr<Expression> endPrimitive = this ->convertExpression (endPrimitiveID);
@@ -809,7 +809,7 @@ std::unique_ptr<Block> IRGenerator::applyInvocationIDWorkaround(std::unique_ptr<
809809 std::vector<std::unique_ptr<Expression>>()))));
810810 std::unique_ptr<Expression> assignment (new BinaryExpression (-1 ,
811811 std::unique_ptr<Expression>(new VariableReference (-1 , loopIdx,
812- VariableReference::kWrite_RefKind )),
812+ VariableReference::RefKind:: kWrite )),
813813 Token::Kind::TK_EQ,
814814 std::make_unique<IntLiteral>(fContext , -1 , 0 ),
815815 fContext .fInt_Type .get ()));
@@ -832,9 +832,9 @@ std::unique_ptr<Statement> IRGenerator::getNormalizeSkPositionCode() {
832832 // sk_Position.w);
833833 SkASSERT (fSkPerVertex && fRTAdjust );
834834 #define REF (var ) std::unique_ptr<Expression>(\
835- new VariableReference (-1 , var, VariableReference::kRead_RefKind ))
835+ new VariableReference (-1 , var, VariableReference::RefKind:: kRead ))
836836 #define WREF (var ) std::unique_ptr<Expression>(\
837- new VariableReference (-1 , var, VariableReference::kWrite_RefKind ))
837+ new VariableReference (-1 , var, VariableReference::RefKind:: kWrite ))
838838 #define FIELD (var, idx ) std::unique_ptr<Expression>(\
839839 new FieldAccess (REF (var), idx, FieldAccess::kAnonymousInterfaceBlock_OwnerKind ))
840840 #define POS std::unique_ptr<Expression>(new FieldAccess(WREF(fSkPerVertex ), 0 , \
@@ -964,7 +964,7 @@ void IRGenerator::convertFunction(const ASTNode& f) {
964964 Variable* var = fSymbolTable ->takeOwnershipOfSymbol (
965965 std::make_unique<Variable>(param.fOffset , fModifiers ->handle (pd.fModifiers ),
966966 name, type, fIsBuiltinCode ,
967- Variable::kParameter_Storage ));
967+ Variable::Storage:: kParameter ));
968968 parameters.push_back (var);
969969 }
970970
@@ -1137,7 +1137,7 @@ std::unique_ptr<InterfaceBlock> IRGenerator::convertInterfaceBlock(const ASTNode
11371137 auto iter = intf.begin ();
11381138 for (size_t i = 0 ; i < id.fDeclarationCount ; ++i) {
11391139 std::vector<std::unique_ptr<Statement>> decls =
1140- this ->convertVarDeclarations (*(iter++), Variable::kInterfaceBlock_Storage );
1140+ this ->convertVarDeclarations (*(iter++), Variable::Storage:: kInterfaceBlock );
11411141 if (decls.empty ()) {
11421142 return nullptr ;
11431143 }
@@ -1205,7 +1205,7 @@ std::unique_ptr<InterfaceBlock> IRGenerator::convertInterfaceBlock(const ASTNode
12051205 id.fInstanceName .fLength ? id.fInstanceName : id.fTypeName ,
12061206 type,
12071207 fIsBuiltinCode ,
1208- Variable::kGlobal_Storage ));
1208+ Variable::Storage:: kGlobal ));
12091209 if (foundRTAdjust) {
12101210 fRTAdjustInterfaceBlock = var;
12111211 }
@@ -1274,7 +1274,7 @@ void IRGenerator::convertEnum(const ASTNode& e) {
12741274 ++currentValue;
12751275 fSymbolTable ->add (std::make_unique<Variable>(e.fOffset , fModifiers ->handle (modifiers),
12761276 child.getString (), type, fIsBuiltinCode ,
1277- Variable::kGlobal_Storage , value.get ()));
1277+ Variable::Storage:: kGlobal , value.get ()));
12781278 fSymbolTable ->takeOwnershipOfIRNode (std::move (value));
12791279 }
12801280 // Now we orphanize the Enum's symbol table, so that future lookups in it are strict
@@ -1431,12 +1431,12 @@ std::unique_ptr<Expression> IRGenerator::convertIdentifier(const ASTNode& identi
14311431 // default to kRead_RefKind; this will be corrected later if the variable is written to
14321432 return std::make_unique<VariableReference>(identifier.fOffset ,
14331433 var,
1434- VariableReference::kRead_RefKind );
1434+ VariableReference::RefKind:: kRead );
14351435 }
14361436 case Symbol::Kind::kField : {
14371437 const Field* field = &result->as <Field>();
14381438 auto base = std::make_unique<VariableReference>(identifier.fOffset , &field->owner (),
1439- VariableReference::kRead_RefKind );
1439+ VariableReference::RefKind:: kRead );
14401440 return std::make_unique<FieldAccess>(std::move (base),
14411441 field->fieldIndex (),
14421442 FieldAccess::kAnonymousInterfaceBlock_OwnerKind );
@@ -1967,8 +1967,8 @@ std::unique_ptr<Expression> IRGenerator::convertBinaryExpression(const ASTNode&
19671967 }
19681968 if (Compiler::IsAssignment (op)) {
19691969 if (!this ->setRefKind (*left, op != Token::Kind::TK_EQ
1970- ? VariableReference::kReadWrite_RefKind
1971- : VariableReference::kWrite_RefKind )) {
1970+ ? VariableReference::RefKind:: kReadWrite
1971+ : VariableReference::RefKind:: kWrite )) {
19721972 return nullptr ;
19731973 }
19741974 }
@@ -2122,8 +2122,8 @@ std::unique_ptr<Expression> IRGenerator::call(int offset,
21222122 const Modifiers& paramModifiers = function.parameters ()[i]->modifiers ();
21232123 if (paramModifiers.fFlags & Modifiers::kOut_Flag ) {
21242124 if (!this ->setRefKind (*arguments[i], paramModifiers.fFlags & Modifiers::kIn_Flag
2125- ? VariableReference::kReadWrite_RefKind
2126- : VariableReference::kPointer_RefKind )) {
2125+ ? VariableReference::RefKind:: kReadWrite
2126+ : VariableReference::RefKind:: kPointer )) {
21272127 return nullptr ;
21282128 }
21292129 }
@@ -2407,7 +2407,7 @@ std::unique_ptr<Expression> IRGenerator::convertPrefixExpression(const ASTNode&
24072407 " ' cannot operate on '" + baseType.displayName () + " '" );
24082408 return nullptr ;
24092409 }
2410- if (!this ->setRefKind (*base, VariableReference::kReadWrite_RefKind )) {
2410+ if (!this ->setRefKind (*base, VariableReference::RefKind:: kReadWrite )) {
24112411 return nullptr ;
24122412 }
24132413 break ;
@@ -2418,7 +2418,7 @@ std::unique_ptr<Expression> IRGenerator::convertPrefixExpression(const ASTNode&
24182418 " ' cannot operate on '" + baseType.displayName () + " '" );
24192419 return nullptr ;
24202420 }
2421- if (!this ->setRefKind (*base, VariableReference::kReadWrite_RefKind )) {
2421+ if (!this ->setRefKind (*base, VariableReference::RefKind:: kReadWrite )) {
24222422 return nullptr ;
24232423 }
24242424 break ;
@@ -2832,7 +2832,7 @@ std::unique_ptr<Expression> IRGenerator::convertPostfixExpression(const ASTNode&
28322832 " ' cannot operate on '" + baseType.displayName () + " '" );
28332833 return nullptr ;
28342834 }
2835- if (!this ->setRefKind (*base, VariableReference::kReadWrite_RefKind )) {
2835+ if (!this ->setRefKind (*base, VariableReference::RefKind:: kReadWrite )) {
28362836 return nullptr ;
28372837 }
28382838 return std::make_unique<PostfixExpression>(std::move (base), expression.getToken ().fKind );
@@ -2975,7 +2975,7 @@ void IRGenerator::convertProgram(Program::Kind kind,
29752975 switch (decl.fKind ) {
29762976 case ASTNode::Kind::kVarDeclarations : {
29772977 std::vector<std::unique_ptr<Statement>> decls =
2978- this ->convertVarDeclarations (decl, Variable::kGlobal_Storage );
2978+ this ->convertVarDeclarations (decl, Variable::Storage:: kGlobal );
29792979 for (auto & varDecl : decls) {
29802980 fProgramElements ->push_back (std::make_unique<GlobalVarDeclaration>(
29812981 decl.fOffset , std::move (varDecl)));
0 commit comments