Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions compiler-rt/lib/rtsan/rtsan_assertions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ template <typename OnViolationAction>
void ExpectNotRealtime(Context &context, OnViolationAction &&OnViolation) {
CHECK(__rtsan_is_initialized());
if (context.InRealtimeContext() && !context.IsBypassed()) {
context.BypassPush();
ScopedBypass sb{context};
OnViolation();
context.BypassPop();
}
}

Expand Down
12 changes: 12 additions & 0 deletions compiler-rt/lib/rtsan/rtsan_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,17 @@ class Context {
int bypass_depth_{0};
};

class ScopedBypass {
public:
[[nodiscard]] explicit ScopedBypass(Context &context) : context_(context) {
context_.BypassPush();
}

~ScopedBypass() { context_.BypassPop(); }

private:
Context &context_;
};

Context &GetContextForThisThread();
} // namespace __rtsan
Loading