[Openmp-commits] [PATCH] D136845: [libarcher] Place classes in anonymous namespace

Nikita Popov via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Oct 31 01:17:35 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1af81ab4846f: [libarcher] Place classes in anonymous namespace (authored by nikic).
Herald added a project: OpenMP.
Herald added a subscriber: openmp-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136845/new/

https://reviews.llvm.org/D136845

Files:
  openmp/tools/archer/ompt-tsan.cpp


Index: openmp/tools/archer/ompt-tsan.cpp
===================================================================
--- openmp/tools/archer/ompt-tsan.cpp
+++ openmp/tools/archer/ompt-tsan.cpp
@@ -56,6 +56,7 @@
 static int runOnTsan;
 static int hasReductionCallback;
 
+namespace {
 class ArcherFlags {
 public:
 #if (LLVM_VERSION) >= 40
@@ -132,6 +133,7 @@
     }
   }
 };
+} // namespace
 
 #if (LLVM_VERSION) >= 40
 extern "C" {
@@ -139,7 +141,7 @@
 void __attribute__((weak)) __tsan_flush_memory() {}
 }
 #endif
-ArcherFlags *archer_flags;
+static ArcherFlags *archer_flags;
 
 #ifndef TsanHappensBefore
 // Thread Sanitizer is a tool that finds races in code.
@@ -232,6 +234,7 @@
 
 // Data structure to provide a threadsafe pool of reusable objects.
 // DataPool<Type of objects>
+namespace {
 template <typename T> struct DataPool final {
   static __thread DataPool<T> *ThreadDataPool;
   std::mutex DPMutex{};
@@ -598,14 +601,15 @@
 
   TaskData(DataPool<TaskData> *dp) : DataPoolEntry<TaskData>(dp) {}
 };
+} // namespace
 
 static inline TaskData *ToTaskData(ompt_data_t *task_data) {
   return reinterpret_cast<TaskData *>(task_data->ptr);
 }
 
 /// Store a mutex for each wait_id to resolve race condition with callbacks.
-std::unordered_map<ompt_wait_id_t, std::mutex> Locks;
-std::mutex LocksMutex;
+static std::unordered_map<ompt_wait_id_t, std::mutex> Locks;
+static std::mutex LocksMutex;
 
 static void ompt_tsan_thread_begin(ompt_thread_t thread_type,
                                    ompt_data_t *thread_data) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136845.471918.patch
Type: text/x-patch
Size: 1529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221031/2e744ef7/attachment.bin>


More information about the Openmp-commits mailing list