Turn fuzzers' FatalError into a macro
To enable better bug de-duplication with ClusterFuzz, FatalError has been turned into a macro. This means that frames one step further down the stack are considered by the de-duplicator. Change-Id: Ib5e4a87c9333960178fa17fafff38815293fb053 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66921 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Alastair Donaldson <afdx@google.com>
This commit is contained in:
parent
8648120bbe
commit
c34f08dd45
|
@ -37,19 +37,24 @@ namespace fuzzers {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
[[noreturn]] void FatalError(const tint::diag::List& diags,
|
// A macro is used to avoid FatalError creating its own stack frame. This leads
|
||||||
const std::string& msg = "") {
|
// to better de-duplication of bug reports, because ClusterFuzz only uses the
|
||||||
auto printer = tint::diag::Printer::create(stderr, true);
|
// top few stack frames for de-duplication, and a FatalError stack frame
|
||||||
if (!msg.empty()) {
|
// provides no useful information.
|
||||||
printer->write(msg + "\n", {diag::Color::kRed, true});
|
#define FatalError(diags, msg_string) \
|
||||||
}
|
do { \
|
||||||
tint::diag::Formatter().format(diags, printer.get());
|
std::string msg = msg_string; \
|
||||||
__builtin_trap();
|
auto printer = tint::diag::Printer::create(stderr, true); \
|
||||||
}
|
if (!msg.empty()) { \
|
||||||
|
printer->write(msg + "\n", {diag::Color::kRed, true}); \
|
||||||
|
} \
|
||||||
|
tint::diag::Formatter().format(diags, printer.get()); \
|
||||||
|
__builtin_trap(); \
|
||||||
|
} while (false)
|
||||||
|
|
||||||
[[noreturn]] void TintInternalCompilerErrorReporter(
|
[[noreturn]] void TintInternalCompilerErrorReporter(
|
||||||
const tint::diag::List& diagnostics) {
|
const tint::diag::List& diagnostics) {
|
||||||
FatalError(diagnostics);
|
FatalError(diagnostics, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SPIRVToolsValidationCheck(const tint::Program& program,
|
bool SPIRVToolsValidationCheck(const tint::Program& program,
|
||||||
|
|
Loading…
Reference in New Issue