[compiler-rt] 6ace680 - [rtsan][compiler-rt] Get rid of [[blocking]] stub in tests (#111392)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 13:21:01 PDT 2024


Author: Chris Apple
Date: 2024-10-07T13:20:58-07:00
New Revision: 6ace680a5cc2aa8a45731605cbbab9f933e667a9

URL: https://github.com/llvm/llvm-project/commit/6ace680a5cc2aa8a45731605cbbab9f933e667a9
DIFF: https://github.com/llvm/llvm-project/commit/6ace680a5cc2aa8a45731605cbbab9f933e667a9.diff

LOG: [rtsan][compiler-rt] Get rid of [[blocking]] stub in tests (#111392)

Added: 
    

Modified: 
    compiler-rt/test/rtsan/blocking_call.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/rtsan/blocking_call.cpp b/compiler-rt/test/rtsan/blocking_call.cpp
index 47ce3d5544cbd6..5c7f9d331096de 100644
--- a/compiler-rt/test/rtsan/blocking_call.cpp
+++ b/compiler-rt/test/rtsan/blocking_call.cpp
@@ -7,28 +7,23 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-// TODO: Remove when [[blocking]] is implemented.
-extern "C" void __rtsan_notify_blocking_call(const char *function_name);
-
-void custom_blocking_function() {
-  // TODO: When [[blocking]] is implemented, don't call this directly.
-  __rtsan_notify_blocking_call(__func__);
-}
-
-void safe_call() {
-  // TODO: When [[blocking]] is implemented, don't call this directly.
-  __rtsan_notify_blocking_call(__func__);
+void custom_blocking_function() [[clang::blocking]] {
+  printf("In blocking function\n");
 }
 
-void process() [[clang::nonblocking]] { custom_blocking_function(); }
+void realtime_function() [[clang::nonblocking]] { custom_blocking_function(); }
+void nonrealtime_function() { custom_blocking_function(); }
 
 int main() {
-  safe_call(); // This shouldn't die, because it isn't in nonblocking context.
-  process();
+  nonrealtime_function();
+  realtime_function();
   return 0;
-  // CHECK-NOT: {{.*safe_call*}}
-  // CHECK: ==ERROR: RealtimeSanitizer: blocking-call
-  // CHECK-NEXT: Call to blocking function `custom_blocking_function` in real-time context!
-  // CHECK-NEXT: {{.*custom_blocking_function*}}
-  // CHECK-NEXT: {{.*process*}}
 }
+
+// CHECK: ==ERROR: RealtimeSanitizer: blocking-call
+// CHECK-NEXT: Call to blocking function `custom_blocking_function()` in real-time context!
+// CHECK-NEXT: {{.*custom_blocking_function*}}
+// CHECK-NEXT: {{.*realtime_function*}}
+
+// should only occur once
+// CHECK-NOT: ==ERROR: RealtimeSanitizer: blocking-call


        


More information about the llvm-commits mailing list