Skip to content

Commit eada7bc

Browse files
Replace SK_DEBUG-wrapped ABORT calls with SkDEBUGFAILF.
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]>
1 parent 1dd2b4b commit eada7bc

7 files changed

+18
-54
lines changed

src/sksl/SkSLCFGGenerator.cpp

+3-9
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,7 @@ bool BasicBlock::tryRemoveLValueBefore(std::vector<BasicBlock::Node>::iterator*
186186
return this->tryRemoveLValueBefore(iter, ternary.ifFalse().get());
187187
}
188188
default:
189-
#ifdef SK_DEBUG
190-
ABORT("invalid lvalue: %s\n", lvalue->description().c_str());
191-
#endif
189+
SkDEBUGFAILF("invalid lvalue: %s\n", lvalue->description().c_str());
192190
return false;
193191
}
194192
}
@@ -287,9 +285,7 @@ bool BasicBlock::tryRemoveExpression(std::vector<BasicBlock::Node>::iterator* it
287285
*iter = fNodes.erase(*iter);
288286
return true;
289287
default:
290-
#ifdef SK_DEBUG
291-
ABORT("unhandled expression: %s\n", expr->description().c_str());
292-
#endif
288+
SkDEBUGFAILF("unhandled expression: %s\n", expr->description().c_str());
293289
return false;
294290
}
295291
}
@@ -655,9 +651,7 @@ void CFGGenerator::addStatement(CFG& cfg, std::unique_ptr<Statement>* s) {
655651
case Statement::Kind::kNop:
656652
break;
657653
default:
658-
#ifdef SK_DEBUG
659-
ABORT("unsupported statement: %s\n", (*s)->description().c_str());
660-
#endif
654+
SkDEBUGFAILF("unsupported statement: %s\n", (*s)->description().c_str());
661655
break;
662656
}
663657
}

src/sksl/SkSLCompiler.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,7 @@ static bool is_dead(const Expression& lvalue, ProgramUsage* usage) {
576576
is_dead(*t.ifFalse(), usage);
577577
}
578578
default:
579-
#ifdef SK_DEBUG
580-
ABORT("invalid lvalue: %s\n", lvalue.description().c_str());
581-
#endif
579+
SkDEBUGFAILF("invalid lvalue: %s\n", lvalue.description().c_str());
582580
return false;
583581
}
584582
}

src/sksl/SkSLGLSLCodeGenerator.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,7 @@ void GLSLCodeGenerator::writeExpression(const Expression& expr, Precedence paren
224224
this->writeIndexExpression(expr.as<IndexExpression>());
225225
break;
226226
default:
227-
#ifdef SK_DEBUG
228-
ABORT("unsupported expression: %s", expr.description().c_str());
229-
#endif
227+
SkDEBUGFAILF("unsupported expression: %s", expr.description().c_str());
230228
break;
231229
}
232230
}
@@ -1312,9 +1310,7 @@ void GLSLCodeGenerator::writeStatement(const Statement& s) {
13121310
this->write(";");
13131311
break;
13141312
default:
1315-
#ifdef SK_DEBUG
1316-
ABORT("unsupported statement: %s", s.description().c_str());
1317-
#endif
1313+
SkDEBUGFAILF("unsupported statement: %s", s.description().c_str());
13181314
break;
13191315
}
13201316
}

src/sksl/SkSLIRGenerator.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -1568,9 +1568,7 @@ std::unique_ptr<Expression> IRGenerator::convertExpression(const ASTNode& expr)
15681568
case ASTNode::Kind::kTernary:
15691569
return this->convertTernaryExpression(expr);
15701570
default:
1571-
#ifdef SK_DEBUG
1572-
ABORT("unsupported expression: %s\n", expr.description().c_str());
1573-
#endif
1571+
SkDEBUGFAILF("unsupported expression: %s\n", expr.description().c_str());
15741572
return nullptr;
15751573
}
15761574
}
@@ -3103,9 +3101,7 @@ IRGenerator::IRBundle IRGenerator::convertProgram(
31033101
break;
31043102
}
31053103
default:
3106-
#ifdef SK_DEBUG
3107-
ABORT("unsupported declaration: %s\n", decl.description().c_str());
3108-
#endif
3104+
SkDEBUGFAILF("unsupported declaration: %s\n", decl.description().c_str());
31093105
break;
31103106
}
31113107
}

src/sksl/SkSLMetalCodeGenerator.cpp

+3-9
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,7 @@ void MetalCodeGenerator::writeExpression(const Expression& expr, Precedence pare
218218
this->writeIndexExpression(expr.as<IndexExpression>());
219219
break;
220220
default:
221-
#ifdef SK_DEBUG
222-
ABORT("unsupported expression: %s", expr.description().c_str());
223-
#endif
221+
SkDEBUGFAILF("unsupported expression: %s", expr.description().c_str());
224222
break;
225223
}
226224
}
@@ -1784,9 +1782,7 @@ void MetalCodeGenerator::writeStatement(const Statement& s) {
17841782
this->write(";");
17851783
break;
17861784
default:
1787-
#ifdef SK_DEBUG
1788-
ABORT("unsupported statement: %s", s.description().c_str());
1789-
#endif
1785+
SkDEBUGFAILF("unsupported statement: %s", s.description().c_str());
17901786
break;
17911787
}
17921788
}
@@ -2218,9 +2214,7 @@ void MetalCodeGenerator::writeProgramElement(const ProgramElement& e) {
22182214
case ProgramElement::Kind::kEnum:
22192215
break;
22202216
default:
2221-
#ifdef SK_DEBUG
2222-
ABORT("unsupported program element: %s\n", e.description().c_str());
2223-
#endif
2217+
SkDEBUGFAILF("unsupported program element: %s\n", e.description().c_str());
22242218
break;
22252219
}
22262220
}

src/sksl/SkSLSPIRVCodeGenerator.cpp

+6-18
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,7 @@ SpvId SPIRVCodeGenerator::getType(const Type& rawType, const MemoryLayout& layou
598598
if (type == *fContext.fTypes.fVoid) {
599599
this->writeInstruction(SpvOpTypeVoid, result, fConstantBuffer);
600600
} else {
601-
#ifdef SK_DEBUG
602-
ABORT("invalid type: %s", type.description().c_str());
603-
#endif
601+
SkDEBUGFAILF("invalid type: %s", type.description().c_str());
604602
}
605603
}
606604
fTypeMap[key] = result;
@@ -723,9 +721,7 @@ SpvId SPIRVCodeGenerator::writeExpression(const Expression& expr, OutputStream&
723721
case Expression::Kind::kIndex:
724722
return this->writeIndexExpression(expr.as<IndexExpression>(), out);
725723
default:
726-
#ifdef SK_DEBUG
727-
ABORT("unsupported expression: %s", expr.description().c_str());
728-
#endif
724+
SkDEBUGFAILF("unsupported expression: %s", expr.description().c_str());
729725
break;
730726
}
731727
return -1;
@@ -2577,9 +2573,7 @@ SpvId SPIRVCodeGenerator::writePrefixExpression(const PrefixExpression& p, Outpu
25772573
} else if (is_signed(fContext, type)) {
25782574
this->writeInstruction(SpvOpSNegate, typeId, result, expr, out);
25792575
} else {
2580-
#ifdef SK_DEBUG
2581-
ABORT("unsupported prefix expression %s", p.description().c_str());
2582-
#endif
2576+
SkDEBUGFAILF("unsupported prefix expression %s", p.description().c_str());
25832577
}
25842578
this->writePrecisionModifier(type, result);
25852579
return result;
@@ -2618,9 +2612,7 @@ SpvId SPIRVCodeGenerator::writePrefixExpression(const PrefixExpression& p, Outpu
26182612
return result;
26192613
}
26202614
default:
2621-
#ifdef SK_DEBUG
2622-
ABORT("unsupported prefix expression: %s", p.description().c_str());
2623-
#endif
2615+
SkDEBUGFAILF("unsupported prefix expression: %s", p.description().c_str());
26242616
return -1;
26252617
}
26262618
}
@@ -2644,9 +2636,7 @@ SpvId SPIRVCodeGenerator::writePostfixExpression(const PostfixExpression& p, Out
26442636
return result;
26452637
}
26462638
default:
2647-
#ifdef SK_DEBUG
2648-
ABORT("unsupported postfix expression %s", p.description().c_str());
2649-
#endif
2639+
SkDEBUGFAILF("unsupported postfix expression %s", p.description().c_str());
26502640
return -1;
26512641
}
26522642
}
@@ -3028,9 +3018,7 @@ void SPIRVCodeGenerator::writeStatement(const Statement& s, OutputStream& out) {
30283018
this->writeInstruction(SpvOpKill, out);
30293019
break;
30303020
default:
3031-
#ifdef SK_DEBUG
3032-
ABORT("unsupported statement: %s", s.description().c_str());
3033-
#endif
3021+
SkDEBUGFAILF("unsupported statement: %s", s.description().c_str());
30343022
break;
30353023
}
30363024
}

src/sksl/ir/SkSLType.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,7 @@ const Type& Type::toCompound(const Context& context, int columns, int rows) cons
204204
default: ABORT("unsupported row count (%d)", rows);
205205
}
206206
}
207-
#ifdef SK_DEBUG
208-
ABORT("unsupported toCompound type %s", this->description().c_str());
209-
#endif
207+
SkDEBUGFAILF("unsupported toCompound type %s", this->description().c_str());
210208
return *context.fTypes.fVoid;
211209
}
212210

0 commit comments

Comments
 (0)