Reporter: Add ScriptLocationScope helper

This commit is contained in:
Arne Welzel 2024-11-26 11:46:43 +01:00
parent c7c96610e3
commit 27e6d87331
2 changed files with 23 additions and 1 deletions

View file

@ -31,8 +31,9 @@ using StringValPtr = IntrusivePtr<StringVal>;
namespace detail {
class AssertStmt;
class Location;
class Expr;
class Frame;
class Location;
} // namespace detail
@ -334,6 +335,20 @@ private:
bool ignore_deprecations;
};
/**
* Helper class pushing the frame's call location onto
* the reporter's location stack, associating the caller's
* location with subsequent output.
*
* The frame's location must remain valid until the object
* is destroyed.
*/
class ScriptLocationScope {
public:
ScriptLocationScope(const zeek::detail::Frame* frame);
~ScriptLocationScope();
};
extern Reporter* reporter;
} // namespace zeek