Skip to content

Commit e069434

Browse files
authored
[rtsan][NFC] Remove unncessary namespace specifiers (#110197)
1 parent d9853a8 commit e069434

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

compiler-rt/lib/rtsan/rtsan.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,19 @@ SANITIZER_INTERFACE_ATTRIBUTE bool __rtsan_is_initialized() {
114114
}
115115

116116
SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_realtime_enter() {
117-
__rtsan::GetContextForThisThread().RealtimePush();
117+
GetContextForThisThread().RealtimePush();
118118
}
119119

120120
SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_realtime_exit() {
121-
__rtsan::GetContextForThisThread().RealtimePop();
121+
GetContextForThisThread().RealtimePop();
122122
}
123123

124124
SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_disable() {
125-
__rtsan::GetContextForThisThread().BypassPush();
125+
GetContextForThisThread().BypassPush();
126126
}
127127

128128
SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_enable() {
129-
__rtsan::GetContextForThisThread().BypassPop();
129+
GetContextForThisThread().BypassPop();
130130
}
131131

132132
SANITIZER_INTERFACE_ATTRIBUTE void

compiler-rt/lib/rtsan/rtsan_context.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <pthread.h>
1818

1919
using namespace __sanitizer;
20+
using namespace __rtsan;
2021

2122
static pthread_key_t context_key;
2223
static pthread_once_t key_once = PTHREAD_ONCE_INIT;
@@ -31,12 +32,12 @@ static __rtsan::Context &GetContextForThisThreadImpl() {
3132
};
3233

3334
pthread_once(&key_once, MakeThreadLocalContextKey);
34-
__rtsan::Context *current_thread_context =
35-
static_cast<__rtsan::Context *>(pthread_getspecific(context_key));
35+
Context *current_thread_context =
36+
static_cast<Context *>(pthread_getspecific(context_key));
3637
if (current_thread_context == nullptr) {
37-
current_thread_context = static_cast<__rtsan::Context *>(
38-
__sanitizer::InternalAlloc(sizeof(__rtsan::Context)));
39-
new (current_thread_context) __rtsan::Context();
38+
current_thread_context =
39+
static_cast<Context *>(InternalAlloc(sizeof(Context)));
40+
new (current_thread_context) Context();
4041
pthread_setspecific(context_key, current_thread_context);
4142
}
4243

@@ -57,6 +58,6 @@ bool __rtsan::Context::InRealtimeContext() const { return realtime_depth_ > 0; }
5758

5859
bool __rtsan::Context::IsBypassed() const { return bypass_depth_ > 0; }
5960

60-
__rtsan::Context &__rtsan::GetContextForThisThread() {
61+
Context &__rtsan::GetContextForThisThread() {
6162
return GetContextForThisThreadImpl();
6263
}

compiler-rt/lib/rtsan/rtsan_diagnostics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void BufferedStackTrace::UnwindImpl(uptr pc, uptr bp, void *context,
3131
} // namespace __sanitizer
3232

3333
namespace {
34-
class Decorator : public __sanitizer::SanitizerCommonDecorator {
34+
class Decorator : public SanitizerCommonDecorator {
3535
public:
3636
Decorator() : SanitizerCommonDecorator() {}
3737
const char *FunctionName() const { return Green(); }

compiler-rt/lib/rtsan/tests/rtsan_test_assertions.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TestRtsanAssertions : public ::testing::Test {
2323
void SetUp() override { __rtsan_ensure_initialized(); }
2424
};
2525

26-
static void ExpectViolationAction(__rtsan::Context &context,
26+
static void ExpectViolationAction(Context &context,
2727
bool expect_violation_callback) {
2828
::testing::MockFunction<void()> mock_on_violation;
2929
EXPECT_CALL(mock_on_violation, Call).Times(expect_violation_callback ? 1 : 0);
@@ -32,22 +32,22 @@ static void ExpectViolationAction(__rtsan::Context &context,
3232

3333
TEST_F(TestRtsanAssertions,
3434
ExpectNotRealtimeDoesNotCallViolationActionIfNotInRealtimeContext) {
35-
__rtsan::Context context{};
35+
Context context{};
3636
ASSERT_FALSE(context.InRealtimeContext());
3737
ExpectViolationAction(context, false);
3838
}
3939

4040
TEST_F(TestRtsanAssertions,
4141
ExpectNotRealtimeCallsViolationActionIfInRealtimeContext) {
42-
__rtsan::Context context{};
42+
Context context{};
4343
context.RealtimePush();
4444
ASSERT_TRUE(context.InRealtimeContext());
4545
ExpectViolationAction(context, true);
4646
}
4747

4848
TEST_F(TestRtsanAssertions,
4949
ExpectNotRealtimeDoesNotCallViolationActionIfRealtimeButBypassed) {
50-
__rtsan::Context context{};
50+
Context context{};
5151
context.RealtimePush();
5252
context.BypassPush();
5353
ASSERT_TRUE(context.IsBypassed());

compiler-rt/lib/rtsan/tests/rtsan_test_context.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <gtest/gtest.h>
1717

18+
using namespace __rtsan;
1819
using namespace ::testing;
1920

2021
class TestRtsanContext : public Test {
@@ -23,26 +24,26 @@ class TestRtsanContext : public Test {
2324
};
2425

2526
TEST_F(TestRtsanContext, IsNotRealtimeAfterDefaultConstruction) {
26-
__rtsan::Context context{};
27+
Context context{};
2728
EXPECT_THAT(context.InRealtimeContext(), Eq(false));
2829
}
2930

3031
TEST_F(TestRtsanContext, IsRealtimeAfterRealtimePush) {
31-
__rtsan::Context context{};
32+
Context context{};
3233
context.RealtimePush();
3334
EXPECT_THAT(context.InRealtimeContext(), Eq(true));
3435
}
3536

3637
TEST_F(TestRtsanContext, IsNotRealtimeAfterRealtimePushAndPop) {
37-
__rtsan::Context context{};
38+
Context context{};
3839
context.RealtimePush();
3940
ASSERT_THAT(context.InRealtimeContext(), Eq(true));
4041
context.RealtimePop();
4142
EXPECT_THAT(context.InRealtimeContext(), Eq(false));
4243
}
4344

4445
TEST_F(TestRtsanContext, RealtimeContextStateIsStatefullyTracked) {
45-
__rtsan::Context context{};
46+
Context context{};
4647
auto const ExpectRealtime = [&context](bool is_rt) {
4748
EXPECT_THAT(context.InRealtimeContext(), Eq(is_rt));
4849
};
@@ -64,18 +65,18 @@ TEST_F(TestRtsanContext, RealtimeContextStateIsStatefullyTracked) {
6465
}
6566

6667
TEST_F(TestRtsanContext, IsNotBypassedAfterDefaultConstruction) {
67-
__rtsan::Context context{};
68+
Context context{};
6869
EXPECT_THAT(context.IsBypassed(), Eq(false));
6970
}
7071

7172
TEST_F(TestRtsanContext, IsBypassedAfterBypassPush) {
72-
__rtsan::Context context{};
73+
Context context{};
7374
context.BypassPush();
7475
EXPECT_THAT(context.IsBypassed(), Eq(true));
7576
}
7677

7778
TEST_F(TestRtsanContext, BypassedStateIsStatefullyTracked) {
78-
__rtsan::Context context{};
79+
Context context{};
7980
auto const ExpectBypassed = [&context](bool is_bypassed) {
8081
EXPECT_THAT(context.IsBypassed(), Eq(is_bypassed));
8182
};

0 commit comments

Comments
 (0)