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 +namespace { template struct DataPool final { static __thread DataPool *ThreadDataPool; std::mutex DPMutex{}; @@ -598,14 +601,15 @@ TaskData(DataPool *dp) : DataPoolEntry(dp) {} }; +} // namespace static inline TaskData *ToTaskData(ompt_data_t *task_data) { return reinterpret_cast(task_data->ptr); } /// Store a mutex for each wait_id to resolve race condition with callbacks. -std::unordered_map Locks; -std::mutex LocksMutex; +static std::unordered_map Locks; +static std::mutex LocksMutex; static void ompt_tsan_thread_begin(ompt_thread_t thread_type, ompt_data_t *thread_data) {