Skip to content

[rtsan][NFC] Remove unncessary namespace specifiers #110197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

cjappl
Copy link
Contributor

@cjappl cjappl commented Sep 27, 2024

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Sep 27, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Chris Apple (cjappl)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/110197.diff

3 Files Affected:

  • (modified) compiler-rt/lib/rtsan/rtsan.cpp (+4-4)
  • (modified) compiler-rt/lib/rtsan/rtsan_context.cpp (+7-6)
  • (modified) compiler-rt/lib/rtsan/rtsan_diagnostics.cpp (+1-1)
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(); }

@cjappl cjappl force-pushed the remove_unncessary_namespaces branch from 0e4fe6c to 1f75338 Compare September 27, 2024 02:11
@cjappl
Copy link
Contributor Author

cjappl commented Sep 27, 2024

CC @davidtrevelyan - just a quick cleanup NFC, submitting this now

@cjappl cjappl merged commit e069434 into llvm:main Sep 27, 2024
5 of 7 checks passed
Sterling-Augustine pushed a commit to Sterling-Augustine/llvm-project that referenced this pull request Sep 27, 2024
qiaojbao pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Oct 31, 2024
…4854f7595

Local branch amd-gfx 2c74854 Merged main:139688a699f6db784bd559b147334f1d51314f9c into amd-gfx:cf8fb1be1ea5
Remote branch main e069434 [rtsan][NFC] Remove unncessary namespace specifiers (llvm#110197)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants