| 1 |
/* |
| 2 |
* Copyright 2021 Google LLC. |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "src/sksl/SkSLErrorReporter.h" |
| 9 |
|
| 10 |
#include "src/base/SkStringView.h" |
| 11 |
#include "src/sksl/SkSLCompiler.h" |
| 12 |
#include "src/sksl/SkSLPosition.h" |
| 13 |
|
| 14 |
namespace SkSL { |
| 15 |
|
| 16 |
void ErrorReporter::error(Position position, std::string_view msg) { |
| 17 |
if (skstd::contains(msg, Compiler::POISON_TAG)) { |
| 18 |
// Don't report errors on poison values. |
| 19 |
return; |
| 20 |
} |
| 21 |
++fErrorCount; |
| 22 |
this->handleError(msg, position); |
| 23 |
} |
| 24 |
|
| 25 |
void TestingOnly_AbortErrorReporter::handleError(std::string_view msg, Position pos) { |
| 26 |
SK_ABORT("%.*s", (int)msg.length(), msg.data()); |
| 27 |
} |
| 28 |
|
| 29 |
} // namespace SkSL |