mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 06:45:16 +00:00
fuzzers: Don't pointlessly format diagnostics
Fuzzers like to generate silly long source, and formatting large spans of these can take considerable time. Only format the diagnostic if it is going to be displayed. Significantly speeds up some fuzzing tests, fixing some timeouts. Also add a minor optimization to the formatter repeat() implementation. Fixed: chromium:1230313 Change-Id: Ib1f6ac0b31010f86cb7f4e1432dc703ecbe52cb0 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58841 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
committed by
Tint LUCI CQ
parent
efceb83536
commit
b29396e472
@@ -15,6 +15,7 @@
|
||||
#include "src/diagnostic/formatter.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
#include "src/diagnostic/diagnostic.h"
|
||||
@@ -96,9 +97,7 @@ struct Formatter::State {
|
||||
/// @param c the character to print `n` times
|
||||
/// @param n the number of times to print character `c`
|
||||
void repeat(char c, size_t n) {
|
||||
while (n-- > 0) {
|
||||
stream << c;
|
||||
}
|
||||
std::fill_n(std::ostream_iterator<char>(stream), n, c);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user