Skip to content

Commit 2c98c51

Browse files
committed
[PR] - move to function-name-is
1 parent 95b54ae commit 2c98c51

File tree

6 files changed

+11
-26
lines changed

6 files changed

+11
-26
lines changed

compiler-rt/lib/rtsan/rtsan_assertions.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ void ExpectNotRealtime(Context &context, const DiagnosticsInfo &info,
2828
if (context.InRealtimeContext() && !context.IsBypassed()) {
2929
ScopedBypass sb{context};
3030

31-
if ((info.type == DiagnosticsInfoType::InterceptedCall &&
32-
IsInterceptorSuppressed(info.func_name)) ||
33-
(info.type == DiagnosticsInfoType::BlockingCall &&
34-
IsBlockingFnSuppressed(info.func_name)))
31+
if (IsFunctionSuppressed(info.func_name))
3532
return;
3633

3734
__sanitizer::BufferedStackTrace stack;

compiler-rt/lib/rtsan/rtsan_checks.inc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@
1717
// SummaryKind should be a string literal.
1818

1919
RTSAN_CHECK(CallStackContains, "call-stack-contains")
20-
RTSAN_CHECK(InterceptedFnName, "intercepted-fn-name")
21-
RTSAN_CHECK(BlockingFnName, "blocking-fn-name")
20+
RTSAN_CHECK(FunctionNameIs, "function-name-is")

compiler-rt/lib/rtsan/rtsan_suppressions.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,15 @@ bool __rtsan::IsStackTraceSuppressed(const StackTrace &stack) {
9393
return false;
9494
}
9595

96-
static bool IsFunctionSuppressed(const char *interceptor_name,
97-
const char *flag_name) {
96+
bool __rtsan::IsFunctionSuppressed(const char *function_name) {
9897
if (suppression_ctx == nullptr)
9998
return false;
10099

100+
const char *flag_name = ConvertTypeToFlagName(ErrorType::FunctionNameIs);
101+
101102
if (!suppression_ctx->HasSuppressionType(flag_name))
102103
return false;
103104

104105
Suppression *s;
105-
return suppression_ctx->Match(interceptor_name, flag_name, &s);
106-
}
107-
108-
bool __rtsan::IsInterceptorSuppressed(const char *interceptor_name) {
109-
return IsFunctionSuppressed(
110-
interceptor_name, ConvertTypeToFlagName(ErrorType::InterceptedFnName));
111-
}
112-
113-
bool __rtsan::IsBlockingFnSuppressed(const char *blocking_fn_name) {
114-
return IsFunctionSuppressed(blocking_fn_name,
115-
ConvertTypeToFlagName(ErrorType::BlockingFnName));
106+
return suppression_ctx->Match(function_name, flag_name, &s);
116107
}

compiler-rt/lib/rtsan/rtsan_suppressions.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ namespace __rtsan {
1818

1919
void InitializeSuppressions();
2020
bool IsStackTraceSuppressed(const __sanitizer::StackTrace &stack);
21-
bool IsInterceptorSuppressed(const char *interceptor_name);
22-
bool IsBlockingFnSuppressed(const char *blocking_fn_name);
21+
bool IsFunctionSuppressed(const char *function_name);
2322

2423
} // namespace __rtsan

compiler-rt/test/rtsan/stack_suppressions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ void BlockFunc() [[clang::blocking]] {
3636
void *process() [[clang::nonblocking]] {
3737
void *ptr = MallocViolation(); // Suppressed call-stack-contains
3838
VectorViolations(); // Suppressed call-stack-contains with regex
39-
BlockFunc(); // Suppressed blocking-fn-name
40-
free(ptr); // Suppressed intercepted-fn-name
39+
BlockFunc(); // Suppressed function-name-is
40+
free(ptr); // Suppressed function-name-is
4141

4242
// This is the one that should abort the program
4343
// Everything else is suppressed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
call-stack-contains:MallocViolation
22
call-stack-contains:std::*vector
33

4-
intercepted-fn-name:free
5-
6-
blocking-fn-name:BlockFunc
4+
function-name-is:free
5+
function-name-is:BlockFunc

0 commit comments

Comments
 (0)