[compiler-rt] e069434 - [rtsan][NFC] Remove unncessary namespace specifiers (#110197)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 19:12:29 PDT 2024
Author: Chris Apple
Date: 2024-09-26T19:12:25-07:00
New Revision: e069434afcd21911ad36c55971bb8f754854c09f
URL: https://github.com/llvm/llvm-project/commit/e069434afcd21911ad36c55971bb8f754854c09f
DIFF: https://github.com/llvm/llvm-project/commit/e069434afcd21911ad36c55971bb8f754854c09f.diff
LOG: [rtsan][NFC] Remove unncessary namespace specifiers (#110197)
Added:
Modified:
compiler-rt/lib/rtsan/rtsan.cpp
compiler-rt/lib/rtsan/rtsan_context.cpp
compiler-rt/lib/rtsan/rtsan_diagnostics.cpp
compiler-rt/lib/rtsan/tests/rtsan_test_assertions.cpp
compiler-rt/lib/rtsan/tests/rtsan_test_context.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/rtsan/rtsan.cpp b/compiler-rt/lib/rtsan/rtsan.cpp
index 6fcff5e326a52f..f9741b4fe3509d 100644
--- a/compiler-rt/lib/rtsan/rtsan.cpp
+++ b/compiler-rt/lib/rtsan/rtsan.cpp
@@ -114,19 +114,19 @@ SANITIZER_INTERFACE_ATTRIBUTE bool __rtsan_is_initialized() {
}
SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_realtime_enter() {
- __rtsan::GetContextForThisThread().RealtimePush();
+ GetContextForThisThread().RealtimePush();
}
SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_realtime_exit() {
- __rtsan::GetContextForThisThread().RealtimePop();
+ GetContextForThisThread().RealtimePop();
}
SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_disable() {
- __rtsan::GetContextForThisThread().BypassPush();
+ GetContextForThisThread().BypassPush();
}
SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_enable() {
- __rtsan::GetContextForThisThread().BypassPop();
+ GetContextForThisThread().BypassPop();
}
SANITIZER_INTERFACE_ATTRIBUTE void
diff --git a/compiler-rt/lib/rtsan/rtsan_context.cpp b/compiler-rt/lib/rtsan/rtsan_context.cpp
index 1cf1791f0aaf83..536d62e81e2fb6 100644
--- a/compiler-rt/lib/rtsan/rtsan_context.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_context.cpp
@@ -17,6 +17,7 @@
#include <pthread.h>
using namespace __sanitizer;
+using namespace __rtsan;
static pthread_key_t context_key;
static pthread_once_t key_once = PTHREAD_ONCE_INIT;
@@ -31,12 +32,12 @@ static __rtsan::Context &GetContextForThisThreadImpl() {
};
pthread_once(&key_once, MakeThreadLocalContextKey);
- __rtsan::Context *current_thread_context =
- static_cast<__rtsan::Context *>(pthread_getspecific(context_key));
+ Context *current_thread_context =
+ static_cast<Context *>(pthread_getspecific(context_key));
if (current_thread_context == nullptr) {
- current_thread_context = static_cast<__rtsan::Context *>(
- __sanitizer::InternalAlloc(sizeof(__rtsan::Context)));
- new (current_thread_context) __rtsan::Context();
+ current_thread_context =
+ static_cast<Context *>(InternalAlloc(sizeof(Context)));
+ new (current_thread_context) Context();
pthread_setspecific(context_key, current_thread_context);
}
@@ -57,6 +58,6 @@ bool __rtsan::Context::InRealtimeContext() const { return realtime_depth_ > 0; }
bool __rtsan::Context::IsBypassed() const { return bypass_depth_ > 0; }
-__rtsan::Context &__rtsan::GetContextForThisThread() {
+Context &__rtsan::GetContextForThisThread() {
return GetContextForThisThreadImpl();
}
diff --git a/compiler-rt/lib/rtsan/rtsan_diagnostics.cpp b/compiler-rt/lib/rtsan/rtsan_diagnostics.cpp
index cfe71481d3dc78..ecba30d2ab8df5 100644
--- a/compiler-rt/lib/rtsan/rtsan_diagnostics.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_diagnostics.cpp
@@ -31,7 +31,7 @@ void BufferedStackTrace::UnwindImpl(uptr pc, uptr bp, void *context,
} // namespace __sanitizer
namespace {
-class Decorator : public __sanitizer::SanitizerCommonDecorator {
+class Decorator : public SanitizerCommonDecorator {
public:
Decorator() : SanitizerCommonDecorator() {}
const char *FunctionName() const { return Green(); }
diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_assertions.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_assertions.cpp
index 58f7dbae96e9f5..3b279989a49cb3 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_assertions.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_assertions.cpp
@@ -23,7 +23,7 @@ class TestRtsanAssertions : public ::testing::Test {
void SetUp() override { __rtsan_ensure_initialized(); }
};
-static void ExpectViolationAction(__rtsan::Context &context,
+static void ExpectViolationAction(Context &context,
bool expect_violation_callback) {
::testing::MockFunction<void()> mock_on_violation;
EXPECT_CALL(mock_on_violation, Call).Times(expect_violation_callback ? 1 : 0);
@@ -32,14 +32,14 @@ static void ExpectViolationAction(__rtsan::Context &context,
TEST_F(TestRtsanAssertions,
ExpectNotRealtimeDoesNotCallViolationActionIfNotInRealtimeContext) {
- __rtsan::Context context{};
+ Context context{};
ASSERT_FALSE(context.InRealtimeContext());
ExpectViolationAction(context, false);
}
TEST_F(TestRtsanAssertions,
ExpectNotRealtimeCallsViolationActionIfInRealtimeContext) {
- __rtsan::Context context{};
+ Context context{};
context.RealtimePush();
ASSERT_TRUE(context.InRealtimeContext());
ExpectViolationAction(context, true);
@@ -47,7 +47,7 @@ TEST_F(TestRtsanAssertions,
TEST_F(TestRtsanAssertions,
ExpectNotRealtimeDoesNotCallViolationActionIfRealtimeButBypassed) {
- __rtsan::Context context{};
+ Context context{};
context.RealtimePush();
context.BypassPush();
ASSERT_TRUE(context.IsBypassed());
diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_context.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_context.cpp
index 7551f67b38d78a..2b6f53b4f572dd 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_context.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_context.cpp
@@ -15,6 +15,7 @@
#include <gtest/gtest.h>
+using namespace __rtsan;
using namespace ::testing;
class TestRtsanContext : public Test {
@@ -23,18 +24,18 @@ class TestRtsanContext : public Test {
};
TEST_F(TestRtsanContext, IsNotRealtimeAfterDefaultConstruction) {
- __rtsan::Context context{};
+ Context context{};
EXPECT_THAT(context.InRealtimeContext(), Eq(false));
}
TEST_F(TestRtsanContext, IsRealtimeAfterRealtimePush) {
- __rtsan::Context context{};
+ Context context{};
context.RealtimePush();
EXPECT_THAT(context.InRealtimeContext(), Eq(true));
}
TEST_F(TestRtsanContext, IsNotRealtimeAfterRealtimePushAndPop) {
- __rtsan::Context context{};
+ Context context{};
context.RealtimePush();
ASSERT_THAT(context.InRealtimeContext(), Eq(true));
context.RealtimePop();
@@ -42,7 +43,7 @@ TEST_F(TestRtsanContext, IsNotRealtimeAfterRealtimePushAndPop) {
}
TEST_F(TestRtsanContext, RealtimeContextStateIsStatefullyTracked) {
- __rtsan::Context context{};
+ Context context{};
auto const ExpectRealtime = [&context](bool is_rt) {
EXPECT_THAT(context.InRealtimeContext(), Eq(is_rt));
};
@@ -64,18 +65,18 @@ TEST_F(TestRtsanContext, RealtimeContextStateIsStatefullyTracked) {
}
TEST_F(TestRtsanContext, IsNotBypassedAfterDefaultConstruction) {
- __rtsan::Context context{};
+ Context context{};
EXPECT_THAT(context.IsBypassed(), Eq(false));
}
TEST_F(TestRtsanContext, IsBypassedAfterBypassPush) {
- __rtsan::Context context{};
+ Context context{};
context.BypassPush();
EXPECT_THAT(context.IsBypassed(), Eq(true));
}
TEST_F(TestRtsanContext, BypassedStateIsStatefullyTracked) {
- __rtsan::Context context{};
+ Context context{};
auto const ExpectBypassed = [&context](bool is_bypassed) {
EXPECT_THAT(context.IsBypassed(), Eq(is_bypassed));
};
More information about the llvm-commits
mailing list