diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2018-06-12 11:05:59 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-12 19:16:03 +0000 |
commit | d9d33c33dee064da260301faa313703e465d44c5 (patch) | |
tree | f2e9a592acde1715d71381d8ff7c97fdaf58edac /src/sksl/SkSLCompiler.cpp | |
parent | 22be4c4801f957f2820b9001b02b892f4b87a157 (diff) |
renamed SkSL's assert macros
Since SkSL needs to run outside of Skia, it was originally using its
own ASSERT macro, which mapped to SkASSERT when inside of Skia. This is
causing conflicts with one or two other ASSERT macros defined around
Skia, so to avoid that I am switching SkSL over to just use Skia's
standard naming for these macros.
Bug: skia:
Change-Id: I115435d7282da03d076c6080f7b13d1972b9eb9f
Reviewed-on: https://skia-review.googlesource.com/134322
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLCompiler.cpp')
-rw-r--r-- | src/sksl/SkSLCompiler.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp index a5f5225bdb..0cf55c26d0 100644 --- a/src/sksl/SkSLCompiler.cpp +++ b/src/sksl/SkSLCompiler.cpp @@ -213,7 +213,7 @@ Compiler::Compiler(Flags flags) if (fErrorCount) { printf("Unexpected errors: %s\n", fErrorText.c_str()); } - ASSERT(!fErrorCount); + SkASSERT(!fErrorCount); Program::Settings settings; fIRGenerator->start(&settings, nullptr); @@ -289,7 +289,7 @@ void Compiler::addDefinition(const Expression* lvalue, std::unique_ptr<Expressio break; default: // not an lvalue, can't happen - ASSERT(false); + SkASSERT(false); } } @@ -298,7 +298,7 @@ void Compiler::addDefinitions(const BasicBlock::Node& node, DefinitionMap* definitions) { switch (node.fKind) { case BasicBlock::Node::kExpression_Kind: { - ASSERT(node.expression()); + SkASSERT(node.expression()); const Expression* expr = (Expression*) node.expression()->get(); switch (expr->fKind) { case Expression::kBinary_Kind: { @@ -420,7 +420,7 @@ static DefinitionMap compute_start_state(const CFG& cfg) { for (const auto& block : cfg.fBlocks) { for (const auto& node : block.fNodes) { if (node.fKind == BasicBlock::Node::kStatement_Kind) { - ASSERT(node.statement()); + SkASSERT(node.statement()); const Statement* s = node.statement()->get(); if (s->fKind == Statement::kVarDeclarations_Kind) { const VarDeclarationsStatement* vd = (const VarDeclarationsStatement*) s; @@ -539,9 +539,9 @@ void delete_left(BasicBlock* b, bool* outNeedsRescan) { *outUpdated = true; std::unique_ptr<Expression>* target = (*iter)->expression(); - ASSERT((*target)->fKind == Expression::kBinary_Kind); + SkASSERT((*target)->fKind == Expression::kBinary_Kind); BinaryExpression& bin = (BinaryExpression&) **target; - ASSERT(!bin.fLeft->hasSideEffects()); + SkASSERT(!bin.fLeft->hasSideEffects()); bool result; if (bin.fOperator == Token::EQ) { result = b->tryRemoveLValueBefore(iter, bin.fLeft.get()); @@ -564,7 +564,7 @@ void delete_left(BasicBlock* b, return; } *iter = b->fNodes.erase(*iter); - ASSERT((*iter)->expression() == target); + SkASSERT((*iter)->expression() == target); } /** @@ -577,9 +577,9 @@ void delete_right(BasicBlock* b, bool* outNeedsRescan) { *outUpdated = true; std::unique_ptr<Expression>* target = (*iter)->expression(); - ASSERT((*target)->fKind == Expression::kBinary_Kind); + SkASSERT((*target)->fKind == Expression::kBinary_Kind); BinaryExpression& bin = (BinaryExpression&) **target; - ASSERT(!bin.fRight->hasSideEffects()); + SkASSERT(!bin.fRight->hasSideEffects()); if (!b->tryRemoveExpressionBefore(iter, bin.fRight.get())) { *target = std::move(bin.fLeft); *outNeedsRescan = true; @@ -597,7 +597,7 @@ void delete_right(BasicBlock* b, return; } *iter = b->fNodes.erase(*iter); - ASSERT((*iter)->expression() == target); + SkASSERT((*iter)->expression() == target); } /** @@ -620,9 +620,9 @@ static void vectorize(BasicBlock* b, std::unique_ptr<Expression>* otherExpression, bool* outUpdated, bool* outNeedsRescan) { - ASSERT((*(*iter)->expression())->fKind == Expression::kBinary_Kind); - ASSERT(type.kind() == Type::kVector_Kind); - ASSERT((*otherExpression)->fType.kind() == Type::kScalar_Kind); + SkASSERT((*(*iter)->expression())->fKind == Expression::kBinary_Kind); + SkASSERT(type.kind() == Type::kVector_Kind); + SkASSERT((*otherExpression)->fType.kind() == Type::kScalar_Kind); *outUpdated = true; std::unique_ptr<Expression>* target = (*iter)->expression(); if (!b->tryRemoveExpression(iter)) { @@ -689,7 +689,7 @@ void Compiler::simplifyExpression(DefinitionMap& definitions, bool* outUpdated, bool* outNeedsRescan) { Expression* expr = (*iter)->expression()->get(); - ASSERT(expr); + SkASSERT(expr); if ((*iter)->fConstantPropagation) { std::unique_ptr<Expression> optimized = expr->constantPropagate(*fIRGenerator, definitions); if (optimized) { @@ -698,7 +698,7 @@ void Compiler::simplifyExpression(DefinitionMap& definitions, *outNeedsRescan = true; return; } - ASSERT((*iter)->fKind == BasicBlock::Node::kExpression_Kind); + SkASSERT((*iter)->fKind == BasicBlock::Node::kExpression_Kind); expr = (*iter)->expression()->get(); } } @@ -972,7 +972,7 @@ void Compiler::simplifyStatement(DefinitionMap& definitions, (!varDecl.fValue || !varDecl.fValue->hasSideEffects())) { if (varDecl.fValue) { - ASSERT((*iter)->statement()->get() == stmt); + SkASSERT((*iter)->statement()->get() == stmt); if (!b.tryRemoveExpressionBefore(iter, varDecl.fValue.get())) { *outNeedsRescan = true; } @@ -987,7 +987,7 @@ void Compiler::simplifyStatement(DefinitionMap& definitions, if (i.fTest->fKind == Expression::kBoolLiteral_Kind) { // constant if, collapse down to a single branch if (((BoolLiteral&) *i.fTest).fValue) { - ASSERT(i.fIfTrue); + SkASSERT(i.fIfTrue); (*iter)->setStatement(std::move(i.fIfTrue)); } else { if (i.fIfFalse) { @@ -1033,7 +1033,7 @@ void Compiler::simplifyStatement(DefinitionMap& definitions, defaultCase = c.get(); continue; } - ASSERT(c->fValue->fKind == s.fValue->fKind); + SkASSERT(c->fValue->fKind == s.fValue->fKind); found = c->fValue->compareConstant(*fContext, *s.fValue); if (found) { std::unique_ptr<Statement> newBlock = block_for_case(&s, c.get()); @@ -1075,13 +1075,13 @@ void Compiler::simplifyStatement(DefinitionMap& definitions, } case Statement::kExpression_Kind: { ExpressionStatement& e = (ExpressionStatement&) *stmt; - ASSERT((*iter)->statement()->get() == &e); + SkASSERT((*iter)->statement()->get() == &e); if (!e.fExpression->hasSideEffects()) { // Expression statement with no side effects, kill it if (!b.tryRemoveExpressionBefore(iter, e.fExpression.get())) { *outNeedsRescan = true; } - ASSERT((*iter)->statement()->get() == stmt); + SkASSERT((*iter)->statement()->get() == stmt); (*iter)->setStatement(std::unique_ptr<Statement>(new Nop())); *outUpdated = true; } @@ -1146,7 +1146,7 @@ void Compiler::scanCFG(FunctionDefinition& f) { } } } while (updated); - ASSERT(!needsRescan); + SkASSERT(!needsRescan); // verify static ifs & switches, clean up dead variable decls for (BasicBlock& b : cfg.fBlocks) { @@ -1283,14 +1283,14 @@ bool Compiler::toSPIRV(const Program& program, OutputStream& out) { if (result) { spvtools::SpirvTools tools(SPV_ENV_VULKAN_1_0); const String& data = buffer.str(); - ASSERT(0 == data.size() % 4); + SkASSERT(0 == data.size() % 4); auto dumpmsg = [](spv_message_level_t, const char*, const spv_position_t&, const char* m) { SkDebugf("SPIR-V validation error: %s\n", m); }; tools.SetMessageConsumer(dumpmsg); - // Verify that the SPIR-V we produced is valid. If this assert fails, check the logs prior + // Verify that the SPIR-V we produced is valid. If this SkASSERT fails, check the logs prior // to the failure to see the validation errors. - ASSERT_RESULT(tools.Validate((const uint32_t*) data.c_str(), data.size() / 4)); + SkAssertResult(tools.Validate((const uint32_t*) data.c_str(), data.size() / 4)); out.write(data.c_str(), data.size()); } #else @@ -1424,7 +1424,7 @@ bool Compiler::IsAssignment(Token::Kind op) { } Position Compiler::position(int offset) { - ASSERT(fSource); + SkASSERT(fSource); int line = 1; int column = 1; for (int i = 0; i < offset; i++) { |