Skip to content

Commit

Permalink
Replace SK_DEBUG-wrapped ABORT calls with SkDEBUGFAILF.
Browse files Browse the repository at this point in the history
Change-Id: I4b11aaa8299a4aa2753097c26936e0176189f1db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364641
Commit-Queue: John Stiles <[email protected]>
Commit-Queue: Brian Osman <[email protected]>
Auto-Submit: John Stiles <[email protected]>
Reviewed-by: Brian Osman <[email protected]>
  • Loading branch information
johnstiles-google committed Feb 2, 2021
1 parent 1dd2b4b commit eada7bc
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 54 deletions.
12 changes: 3 additions & 9 deletions src/sksl/SkSLCFGGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,7 @@ bool BasicBlock::tryRemoveLValueBefore(std::vector<BasicBlock::Node>::iterator*
return this->tryRemoveLValueBefore(iter, ternary.ifFalse().get());
}
default:
#ifdef SK_DEBUG
ABORT("invalid lvalue: %s\n", lvalue->description().c_str());
#endif
SkDEBUGFAILF("invalid lvalue: %s\n", lvalue->description().c_str());
return false;
}
}
Expand Down Expand Up @@ -287,9 +285,7 @@ bool BasicBlock::tryRemoveExpression(std::vector<BasicBlock::Node>::iterator* it
*iter = fNodes.erase(*iter);
return true;
default:
#ifdef SK_DEBUG
ABORT("unhandled expression: %s\n", expr->description().c_str());
#endif
SkDEBUGFAILF("unhandled expression: %s\n", expr->description().c_str());
return false;
}
}
Expand Down Expand Up @@ -655,9 +651,7 @@ void CFGGenerator::addStatement(CFG& cfg, std::unique_ptr<Statement>* s) {
case Statement::Kind::kNop:
break;
default:
#ifdef SK_DEBUG
ABORT("unsupported statement: %s\n", (*s)->description().c_str());
#endif
SkDEBUGFAILF("unsupported statement: %s\n", (*s)->description().c_str());
break;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/sksl/SkSLCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,7 @@ static bool is_dead(const Expression& lvalue, ProgramUsage* usage) {
is_dead(*t.ifFalse(), usage);
}
default:
#ifdef SK_DEBUG
ABORT("invalid lvalue: %s\n", lvalue.description().c_str());
#endif
SkDEBUGFAILF("invalid lvalue: %s\n", lvalue.description().c_str());
return false;
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/sksl/SkSLGLSLCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,7 @@ void GLSLCodeGenerator::writeExpression(const Expression& expr, Precedence paren
this->writeIndexExpression(expr.as<IndexExpression>());
break;
default:
#ifdef SK_DEBUG
ABORT("unsupported expression: %s", expr.description().c_str());
#endif
SkDEBUGFAILF("unsupported expression: %s", expr.description().c_str());
break;
}
}
Expand Down Expand Up @@ -1312,9 +1310,7 @@ void GLSLCodeGenerator::writeStatement(const Statement& s) {
this->write(";");
break;
default:
#ifdef SK_DEBUG
ABORT("unsupported statement: %s", s.description().c_str());
#endif
SkDEBUGFAILF("unsupported statement: %s", s.description().c_str());
break;
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/sksl/SkSLIRGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1568,9 +1568,7 @@ std::unique_ptr<Expression> IRGenerator::convertExpression(const ASTNode& expr)
case ASTNode::Kind::kTernary:
return this->convertTernaryExpression(expr);
default:
#ifdef SK_DEBUG
ABORT("unsupported expression: %s\n", expr.description().c_str());
#endif
SkDEBUGFAILF("unsupported expression: %s\n", expr.description().c_str());
return nullptr;
}
}
Expand Down Expand Up @@ -3103,9 +3101,7 @@ IRGenerator::IRBundle IRGenerator::convertProgram(
break;
}
default:
#ifdef SK_DEBUG
ABORT("unsupported declaration: %s\n", decl.description().c_str());
#endif
SkDEBUGFAILF("unsupported declaration: %s\n", decl.description().c_str());
break;
}
}
Expand Down
12 changes: 3 additions & 9 deletions src/sksl/SkSLMetalCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,7 @@ void MetalCodeGenerator::writeExpression(const Expression& expr, Precedence pare
this->writeIndexExpression(expr.as<IndexExpression>());
break;
default:
#ifdef SK_DEBUG
ABORT("unsupported expression: %s", expr.description().c_str());
#endif
SkDEBUGFAILF("unsupported expression: %s", expr.description().c_str());
break;
}
}
Expand Down Expand Up @@ -1784,9 +1782,7 @@ void MetalCodeGenerator::writeStatement(const Statement& s) {
this->write(";");
break;
default:
#ifdef SK_DEBUG
ABORT("unsupported statement: %s", s.description().c_str());
#endif
SkDEBUGFAILF("unsupported statement: %s", s.description().c_str());
break;
}
}
Expand Down Expand Up @@ -2218,9 +2214,7 @@ void MetalCodeGenerator::writeProgramElement(const ProgramElement& e) {
case ProgramElement::Kind::kEnum:
break;
default:
#ifdef SK_DEBUG
ABORT("unsupported program element: %s\n", e.description().c_str());
#endif
SkDEBUGFAILF("unsupported program element: %s\n", e.description().c_str());
break;
}
}
Expand Down
24 changes: 6 additions & 18 deletions src/sksl/SkSLSPIRVCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,7 @@ SpvId SPIRVCodeGenerator::getType(const Type& rawType, const MemoryLayout& layou
if (type == *fContext.fTypes.fVoid) {
this->writeInstruction(SpvOpTypeVoid, result, fConstantBuffer);
} else {
#ifdef SK_DEBUG
ABORT("invalid type: %s", type.description().c_str());
#endif
SkDEBUGFAILF("invalid type: %s", type.description().c_str());
}
}
fTypeMap[key] = result;
Expand Down Expand Up @@ -723,9 +721,7 @@ SpvId SPIRVCodeGenerator::writeExpression(const Expression& expr, OutputStream&
case Expression::Kind::kIndex:
return this->writeIndexExpression(expr.as<IndexExpression>(), out);
default:
#ifdef SK_DEBUG
ABORT("unsupported expression: %s", expr.description().c_str());
#endif
SkDEBUGFAILF("unsupported expression: %s", expr.description().c_str());
break;
}
return -1;
Expand Down Expand Up @@ -2577,9 +2573,7 @@ SpvId SPIRVCodeGenerator::writePrefixExpression(const PrefixExpression& p, Outpu
} else if (is_signed(fContext, type)) {
this->writeInstruction(SpvOpSNegate, typeId, result, expr, out);
} else {
#ifdef SK_DEBUG
ABORT("unsupported prefix expression %s", p.description().c_str());
#endif
SkDEBUGFAILF("unsupported prefix expression %s", p.description().c_str());
}
this->writePrecisionModifier(type, result);
return result;
Expand Down Expand Up @@ -2618,9 +2612,7 @@ SpvId SPIRVCodeGenerator::writePrefixExpression(const PrefixExpression& p, Outpu
return result;
}
default:
#ifdef SK_DEBUG
ABORT("unsupported prefix expression: %s", p.description().c_str());
#endif
SkDEBUGFAILF("unsupported prefix expression: %s", p.description().c_str());
return -1;
}
}
Expand All @@ -2644,9 +2636,7 @@ SpvId SPIRVCodeGenerator::writePostfixExpression(const PostfixExpression& p, Out
return result;
}
default:
#ifdef SK_DEBUG
ABORT("unsupported postfix expression %s", p.description().c_str());
#endif
SkDEBUGFAILF("unsupported postfix expression %s", p.description().c_str());
return -1;
}
}
Expand Down Expand Up @@ -3028,9 +3018,7 @@ void SPIRVCodeGenerator::writeStatement(const Statement& s, OutputStream& out) {
this->writeInstruction(SpvOpKill, out);
break;
default:
#ifdef SK_DEBUG
ABORT("unsupported statement: %s", s.description().c_str());
#endif
SkDEBUGFAILF("unsupported statement: %s", s.description().c_str());
break;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/sksl/ir/SkSLType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ const Type& Type::toCompound(const Context& context, int columns, int rows) cons
default: ABORT("unsupported row count (%d)", rows);
}
}
#ifdef SK_DEBUG
ABORT("unsupported toCompound type %s", this->description().c_str());
#endif
SkDEBUGFAILF("unsupported toCompound type %s", this->description().c_str());
return *context.fTypes.fVoid;
}

Expand Down

0 comments on commit eada7bc

Please sign in to comment.