summaryrefslogtreecommitdiff
path: root/src/tools/fuzzing.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r--src/tools/fuzzing.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index 9789a3a5b..4eb0c3960 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -138,8 +138,19 @@ private:
FunctionCreationContext* funcContext = nullptr;
+public:
int nesting = 0;
+ struct AutoNester {
+ TranslateToFuzzReader& parent;
+
+ AutoNester(TranslateToFuzzReader& parent) : parent(parent) {
+ parent.nesting++;
+ }
+ ~AutoNester() { parent.nesting--; }
+ };
+
+private:
// Generating random data is common enough that it's worth having helpers that
// forward to `random`.
int8_t get() { return random.get(); }