Skip to content
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

[sanitizers][NFC] delete some copy constructor and copy assignment to more comply to rule of three #112844

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yingcong-wu
Copy link
Contributor

Delete some copy constructor and copy assignment to make codes more compliant with rule of three.

@llvmbot
Copy link
Collaborator

llvmbot commented Oct 18, 2024

@llvm/pr-subscribers-llvm-transforms
@llvm/pr-subscribers-pgo

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

Author: Wu Yingcong (yingcong-wu)

Changes

Delete some copy constructor and copy assignment to make codes more compliant with rule of three.


Patch is 21.97 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/112844.diff

32 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_report.cpp (+3)
  • (modified) compiler-rt/lib/asan/asan_stack.cpp (+3)
  • (modified) compiler-rt/lib/fuzzer/FuzzerCorpus.h (+2)
  • (modified) compiler-rt/lib/fuzzer/FuzzerFork.cpp (+3)
  • (modified) compiler-rt/lib/fuzzer/FuzzerInternal.h (+12)
  • (modified) compiler-rt/lib/fuzzer/FuzzerLoop.cpp (+3)
  • (modified) compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp (+4-1)
  • (modified) compiler-rt/lib/lsan/lsan_common.h (+3)
  • (modified) compiler-rt/lib/msan/msan.cpp (+3)
  • (modified) compiler-rt/lib/msan/msan.h (+3)
  • (modified) compiler-rt/lib/msan/msan_interceptors.cpp (+2)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_addrhashmap.h (+3)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cpp (+4)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_common.h (+8)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h (+3)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_file.h (+3)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h (+2)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_ring_buffer.h (+2)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp (+11)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_symbolizer.h (+6)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp (+3)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h (+4)
  • (modified) compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h (+3)
  • (modified) compiler-rt/lib/tsan/rtl/tsan_interceptors.h (+3)
  • (modified) compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp (+5)
  • (modified) compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp (+3)
  • (modified) compiler-rt/lib/tsan/rtl/tsan_rtl.h (+9)
  • (modified) compiler-rt/lib/tsan/rtl/tsan_vector_clock.h (+2)
  • (modified) compiler-rt/lib/ubsan/ubsan_diag.h (+3)
  • (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+5)
  • (modified) llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp (+10-7)
  • (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1)
diff --git a/compiler-rt/lib/asan/asan_report.cpp b/compiler-rt/lib/asan/asan_report.cpp
index 45aa607dcda07f..b6f5a657eac6c8 100644
--- a/compiler-rt/lib/asan/asan_report.cpp
+++ b/compiler-rt/lib/asan/asan_report.cpp
@@ -210,6 +210,9 @@ class ScopedInErrorReport {
   // with the debugger and point it to an error description.
   static ErrorDescription current_error_;
   bool halt_on_error_;
+
+  ScopedInErrorReport(const ScopedInErrorReport &) = delete;
+  ScopedInErrorReport &operator=(const ScopedInErrorReport &) = delete;
 };
 
 ErrorDescription ScopedInErrorReport::current_error_(LINKER_INITIALIZED);
diff --git a/compiler-rt/lib/asan/asan_stack.cpp b/compiler-rt/lib/asan/asan_stack.cpp
index 764c6ac193fb06..5f2694908bf15e 100644
--- a/compiler-rt/lib/asan/asan_stack.cpp
+++ b/compiler-rt/lib/asan/asan_stack.cpp
@@ -47,6 +47,9 @@ class ScopedUnwinding {
  private:
   AsanThread *thread = nullptr;
   bool can_unwind = true;
+
+  ScopedUnwinding(const ScopedUnwinding &) = delete;
+  ScopedUnwinding &operator=(const ScopedUnwinding &) = delete;
 };
 
 }  // namespace
diff --git a/compiler-rt/lib/fuzzer/FuzzerCorpus.h b/compiler-rt/lib/fuzzer/FuzzerCorpus.h
index 48b5a2cff02e25..6a227b3293fe75 100644
--- a/compiler-rt/lib/fuzzer/FuzzerCorpus.h
+++ b/compiler-rt/lib/fuzzer/FuzzerCorpus.h
@@ -469,6 +469,8 @@ class InputCorpus {
   size_t NumFeatureUpdates() const { return NumUpdatedFeatures; }
 
 private:
+  InputCorpus(const InputCorpus &) = delete;
+  InputCorpus &operator=(const InputCorpus &) = delete;
 
   static const bool FeatureDebug = false;
 
diff --git a/compiler-rt/lib/fuzzer/FuzzerFork.cpp b/compiler-rt/lib/fuzzer/FuzzerFork.cpp
index e544cd846e4db5..c40c4e7e31d853 100644
--- a/compiler-rt/lib/fuzzer/FuzzerFork.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerFork.cpp
@@ -83,6 +83,9 @@ struct FuzzJob {
     RmDirRecursive(CorpusDir);
     RmDirRecursive(FeaturesDir);
   }
+
+  FuzzJob(const FuzzJob &) = delete;
+  FuzzJob &operator=(const FuzzJob &) = delete;
 };
 
 struct GlobalEnv {
diff --git a/compiler-rt/lib/fuzzer/FuzzerInternal.h b/compiler-rt/lib/fuzzer/FuzzerInternal.h
index 88504705137a8f..49b4dbcdf5ee1b 100644
--- a/compiler-rt/lib/fuzzer/FuzzerInternal.h
+++ b/compiler-rt/lib/fuzzer/FuzzerInternal.h
@@ -34,6 +34,8 @@ class Fuzzer final {
   Fuzzer(UserCallback CB, InputCorpus &Corpus, MutationDispatcher &MD,
          const FuzzingOptions &Options);
   ~Fuzzer() = delete;
+  Fuzzer(const Fuzzer &) = delete;
+  Fuzzer &operator=(const Fuzzer &) = delete;
   void Loop(std::vector<SizedFile> &CorporaFiles);
   void ReadAndExecuteSeedCorpora(std::vector<SizedFile> &CorporaFiles);
   void MinimizeCrashLoop(const Unit &U);
@@ -160,6 +162,11 @@ struct ScopedEnableMsanInterceptorChecks {
     if (EF->__msan_scoped_disable_interceptor_checks)
       EF->__msan_scoped_disable_interceptor_checks();
   }
+
+  ScopedEnableMsanInterceptorChecks(const ScopedEnableMsanInterceptorChecks &) =
+      delete;
+  ScopedEnableMsanInterceptorChecks &
+  operator=(const ScopedEnableMsanInterceptorChecks &) = delete;
 };
 
 struct ScopedDisableMsanInterceptorChecks {
@@ -171,6 +178,11 @@ struct ScopedDisableMsanInterceptorChecks {
     if (EF->__msan_scoped_enable_interceptor_checks)
       EF->__msan_scoped_enable_interceptor_checks();
   }
+
+  ScopedDisableMsanInterceptorChecks(
+      const ScopedDisableMsanInterceptorChecks &) = delete;
+  ScopedDisableMsanInterceptorChecks &
+  operator=(const ScopedDisableMsanInterceptorChecks &) = delete;
 };
 
 } // namespace fuzzer
diff --git a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp
index 6f415dd5763ac9..68ce839f41cc4a 100644
--- a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp
@@ -92,6 +92,9 @@ class TraceLock {
 
 private:
   std::lock_guard<std::recursive_mutex> Lock;
+
+  TraceLock(const TraceLock &) = delete;
+  TraceLock &operator=(const TraceLock &) = delete;
 };
 
 ATTRIBUTE_NO_SANITIZE_MEMORY
diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
index 37aecae7237ae9..d951d1014bcf35 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
@@ -98,7 +98,10 @@ void CALLBACK AlarmHandler(PVOID, BOOLEAN) {
 
 class TimerQ {
   HANDLE TimerQueue;
- public:
+  TimerQ(const TimerQ &) = delete;
+  TimerQ &operator=(const TimerQ &) = delete;
+
+public:
   TimerQ() : TimerQueue(NULL) {}
   ~TimerQ() {
     if (TimerQueue)
diff --git a/compiler-rt/lib/lsan/lsan_common.h b/compiler-rt/lib/lsan/lsan_common.h
index f990c7850497a5..cda2b2705d88d8 100644
--- a/compiler-rt/lib/lsan/lsan_common.h
+++ b/compiler-rt/lib/lsan/lsan_common.h
@@ -285,6 +285,9 @@ void EnableInThisThread();
 struct ScopedInterceptorDisabler {
   ScopedInterceptorDisabler() { DisableInThisThread(); }
   ~ScopedInterceptorDisabler() { EnableInThisThread(); }
+  ScopedInterceptorDisabler(const ScopedInterceptorDisabler &) = delete;
+  ScopedInterceptorDisabler &operator=(const ScopedInterceptorDisabler &) =
+      delete;
 };
 
 // According to Itanium C++ ABI array cookie is a one word containing
diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp
index 6c27ab21eeebfd..cb15419936c7cd 100644
--- a/compiler-rt/lib/msan/msan.cpp
+++ b/compiler-rt/lib/msan/msan.cpp
@@ -86,6 +86,9 @@ bool IsInSymbolizerOrUnwider() { return is_in_symbolizer_or_unwinder; }
 struct UnwinderScope {
   UnwinderScope() { EnterSymbolizerOrUnwider(); }
   ~UnwinderScope() { ExitSymbolizerOrUnwider(); }
+
+  UnwinderScope(const UnwinderScope &) = delete;
+  UnwinderScope &operator=(const UnwinderScope &) = delete;
 };
 
 static Flags msan_flags;
diff --git a/compiler-rt/lib/msan/msan.h b/compiler-rt/lib/msan/msan.h
index 7fb58be67a02cd..8dab07b78d6542 100644
--- a/compiler-rt/lib/msan/msan.h
+++ b/compiler-rt/lib/msan/msan.h
@@ -354,6 +354,9 @@ class ScopedThreadLocalStateBackup {
   void Restore();
  private:
   u64 va_arg_overflow_size_tls;
+  ScopedThreadLocalStateBackup(const ScopedThreadLocalStateBackup &) = delete;
+  ScopedThreadLocalStateBackup &operator=(
+      const ScopedThreadLocalStateBackup &) = delete;
 };
 
 void MsanTSDInit(void (*destructor)(void *tsd));
diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp
index f05c20618780b7..7b11a9a8da4a95 100644
--- a/compiler-rt/lib/msan/msan_interceptors.cpp
+++ b/compiler-rt/lib/msan/msan_interceptors.cpp
@@ -71,6 +71,8 @@ void __msan_scoped_enable_interceptor_checks() { --in_interceptor_scope; }
 struct InterceptorScope {
   InterceptorScope() { ++in_interceptor_scope; }
   ~InterceptorScope() { --in_interceptor_scope; }
+  InterceptorScope(const InterceptorScope &) = delete;
+  InterceptorScope &operator=(const InterceptorScope &) = delete;
 };
 
 bool IsInInterceptorScope() {
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_addrhashmap.h b/compiler-rt/lib/sanitizer_common/sanitizer_addrhashmap.h
index fe48b9caf0670b..66ee60c4094175 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_addrhashmap.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_addrhashmap.h
@@ -92,6 +92,9 @@ class AddrHashMap {
     bool                   created_;
     bool                   remove_;
     bool                   create_;
+
+    Handle(const Handle &) = delete;
+    Handle &operator=(const Handle &) = delete;
   };
 
   typedef void (*ForEachCallback)(const uptr key, const T &val, void *arg);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cpp
index 129f925e6fb686..26a5b5da741c54 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cpp
@@ -38,6 +38,10 @@ class ScopedAllocatorErrorReport {
   const char *error_summary;
   const StackTrace* const stack;
   const SanitizerCommonDecorator d;
+
+  ScopedAllocatorErrorReport(const ScopedAllocatorErrorReport &) = delete;
+  ScopedAllocatorErrorReport &operator=(const ScopedAllocatorErrorReport &) =
+      delete;
 };
 
 void NORETURN ReportCallocOverflow(uptr count, uptr size,
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
index 082d2158e579bd..c408484d49917c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -261,6 +261,8 @@ class ScopedErrorReportLock {
   static void CheckLocked() SANITIZER_CHECK_LOCKED(mutex_);
 
  private:
+  ScopedErrorReportLock(const ScopedErrorReportLock &) = delete;
+  ScopedErrorReportLock &operator=(const ScopedErrorReportLock &) = delete;
   static atomic_uintptr_t reporting_thread_;
   static StaticSpinMutex mutex_;
 };
@@ -908,6 +910,9 @@ class ListOfModules {
     initialized = true;
   }
 
+  ListOfModules(const ListOfModules &) = delete;
+  ListOfModules &operator=(const ListOfModules &) = delete;
+
   InternalMmapVectorNoCtor<LoadedModule> modules_;
   // We rarely have more than 16K loaded modules.
   static const uptr kInitialCapacity = 1 << 14;
@@ -1054,6 +1059,9 @@ class RunOnDestruction {
 
  private:
   Fn fn_;
+
+  RunOnDestruction(const RunOnDestruction &) = delete;
+  RunOnDestruction &operator=(const RunOnDestruction &) = delete;
 };
 
 // A simple scope guard. Usage:
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h
index 7f461c98bade44..45f63d456e5473 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h
@@ -67,6 +67,9 @@ struct DDCallback {
   virtual u32 Unwind() { return 0; }
   virtual int UniqueTid() { return 0; }
 
+  RingBuffer(const RingBuffer &) = delete;
+  RingBuffer &operator=(const RingBuffer &) = delete;
+
  protected:
   ~DDCallback() {}
 };
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.h b/compiler-rt/lib/sanitizer_common/sanitizer_file.h
index bef2c842d9f24f..da21a6949092e6 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_file.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.h
@@ -71,6 +71,9 @@ struct FileCloser {
   explicit FileCloser(fd_t fd) : fd(fd) {}
   ~FileCloser() { CloseFile(fd); }
   fd_t fd;
+
+  FileCloser(const FileCloser &) = delete;
+  FileCloser &operator=(const FileCloser &) = delete;
 };
 
 bool SupportsColoredOutput(fd_t fd);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
index bf3c2c28e32e39..cbd79f28e17fcd 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
@@ -112,6 +112,8 @@ class MemoryMappingLayout : public MemoryMappingLayoutBase {
 
  private:
   void LoadFromCache();
+  MemoryMappingLayout(const MemoryMappingLayout &) = delete;
+  MemoryMappingLayout &operator=(const MemoryMappingLayout &) = delete;
 };
 
 // Returns code range for the specified module.
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_ring_buffer.h b/compiler-rt/lib/sanitizer_common/sanitizer_ring_buffer.h
index 6222a958b11682..96a81df09ebeb1 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_ring_buffer.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_ring_buffer.h
@@ -66,6 +66,7 @@ class RingBuffer {
   RingBuffer() {}
   ~RingBuffer() {}
   RingBuffer(const RingBuffer&) = delete;
+  RingBuffer &operator=(const RingBuffer &) = delete;
 
   // Data layout:
   // LNDDDDDDDD
@@ -159,6 +160,7 @@ class CompactRingBuffer {
  public:
   ~CompactRingBuffer() {}
   CompactRingBuffer(const CompactRingBuffer &) = delete;
+  CompactRingBuffer &operator=(const CompactRingBuffer &) = delete;
 
   uptr long_;
 };
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
index 945da99d41f4ea..0c3a0c5df25f80 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
@@ -358,6 +358,10 @@ class ScopedStackSpaceWithGuard {
   uptr stack_size_;
   uptr guard_size_;
   uptr guard_start_;
+
+  ScopedStackSpaceWithGuard(const ScopedStackSpaceWithGuard &) = delete;
+  ScopedStackSpaceWithGuard &operator=(const ScopedStackSpaceWithGuard &) =
+      delete;
 };
 
 // We have a limitation on the stack frame size, so some stuff had to be moved
@@ -383,6 +387,9 @@ class StopTheWorldScope {
 
  private:
   int process_was_dumpable_;
+
+  StopTheWorldScope(const StopTheWorldScope &) = delete;
+  StopTheWorldScope &operator=(const StopTheWorldScope &) = delete;
 };
 
 // When sanitizer output is being redirected to file (i.e. by using log_path),
@@ -397,6 +404,10 @@ struct ScopedSetTracerPID {
     stoptheworld_tracer_pid = 0;
     stoptheworld_tracer_ppid = 0;
   }
+
+ private:
+  ScopedSetTracerPID(const ScopedSetTracerPID &) = delete;
+  ScopedSetTracerPID &operator=(const ScopedSetTracerPID &) = delete;
 };
 
 void StopTheWorld(StopTheWorldCallback callback, void *argument) {
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer.h b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer.h
index bd89dc4e302fc9..f8ac653e2f1f55 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer.h
@@ -72,6 +72,9 @@ class SymbolizedStackHolder {
       Stack->ClearAll();
   }
 
+  SymbolizedStackHolder(const SymbolizedStackHolder &) = delete;
+  SymbolizedStackHolder &operator=(const SymbolizedStackHolder &) = delete;
+
  public:
   explicit SymbolizedStackHolder(SymbolizedStack *Stack = nullptr)
       : Stack(Stack) {}
@@ -235,6 +238,9 @@ class Symbolizer final {
    private:
     const Symbolizer *sym_;
     int errno_;  // Backup errno in case symbolizer change the value.
+
+    SymbolizerScope(const SymbolizerScope &) = delete;
+    SymbolizerScope &operator=(const SymbolizerScope &) = delete;
   };
 };
 
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
index 1ff8b8f1bab480..69d0ef7e416490 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
@@ -194,6 +194,9 @@ struct ScopedHandle {
     return h;
   }
   HANDLE h_;
+
+  ScopedHandle(const ScopedHandle &) = delete;
+  ScopedHandle &operator=(const ScopedHandle &) = delete;
 };
 } // namespace
 
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h
index e06abb3932da5c..b70686b06f4ef1 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h
@@ -83,6 +83,10 @@ class ThreadContextBase {
 
  protected:
   ~ThreadContextBase();
+
+ private:
+  ThreadContextBase(const ThreadContextBase &) = delete;
+  ThreadContextBase &operator=(const ThreadContextBase &) = delete;
 };
 
 typedef ThreadContextBase* (*ThreadContextFactory)(u32 tid);
diff --git a/compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h b/compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h
index 2eaff39057bc5e..c60af0b16d5ccd 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h
@@ -189,6 +189,9 @@ class DenseSlabAlloc {
     atomic_store_relaxed(&fillpos_, fillpos + 1);
     CHECK(c->pos);
   }
+
+  DenseSlabAlloc(const DenseSlabAlloc &) = delete;
+  DenseSlabAlloc &operator=(const DenseSlabAlloc &) = delete;
 };
 
 }  // namespace __tsan
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.h b/compiler-rt/lib/tsan/rtl/tsan_interceptors.h
index a357a870fdf8e8..73c0abf08feb9e 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.h
@@ -27,6 +27,9 @@ class ScopedInterceptor {
 
   void DisableIgnoresImpl();
   void EnableIgnoresImpl();
+
+  ScopedInterceptor(const ScopedInterceptor &) = delete;
+  ScopedInterceptor &operator=(const ScopedInterceptor &) = delete;
 };
 
 struct TsanInterceptorContext {
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index 423d97e94d81ae..8a353ded60e438 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -386,6 +386,8 @@ struct BlockingCall {
   }
 
   ThreadState *thr;
+  BlockingCall(const BlockingCall &) = delete;
+  BlockingCall &operator=(const BlockingCall &) = delete;
 };
 
 TSAN_INTERCEPTOR(unsigned, sleep, unsigned sec) {
@@ -2669,6 +2671,9 @@ struct ScopedSyscall {
   ~ScopedSyscall() {
     ProcessPendingSignals(thr);
   }
+
+  ScopedSyscall(const ScopedSyscall &) = delete;
+  ScopedSyscall &operator=(const ScopedSyscall &) = delete;
 };
 
 #if !SANITIZER_FREEBSD && !SANITIZER_APPLE
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp b/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp
index befd6a369026d8..49fada836ff380 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp
@@ -41,6 +41,9 @@ class ScopedAnnotation {
   }
  private:
   ThreadState *const thr_;
+
+  ScopedAnnotation(const ScopedAnnotation &) = delete;
+  ScopedAnnotation &operator=(const ScopedAnnotation &) = delete;
 };
 
 #define SCOPED_ANNOTATION_RET(typ, ret)                     \
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
index f48be8e0a4fe08..6c3d40b9b26ed0 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
@@ -128,6 +128,9 @@ struct Processor {
 struct ScopedGlobalProcessor {
   ScopedGlobalProcessor();
   ~ScopedGlobalProcessor();
+
+  ScopedGlobalProcessor(const ScopedGlobalProcessor &) = delete;
+  ScopedGlobalProcessor &operator=(const ScopedGlobalProcessor &) = delete;
 };
 #endif
 
@@ -398,6 +401,9 @@ struct ScopedIgnoreInterceptors {
     cur_thread()->ignore_interceptors--;
 #endif
   }
+  ScopedIgnoreInterceptors(const ScopedIgnoreInterceptors &) = delete;
+  ScopedIgnoreInterceptors &operator=(const ScopedIgnoreInterceptors &) =
+      delete;
 };
 
 const char *GetObjectTypeFromTag(uptr tag);
@@ -650,6 +656,9 @@ class SlotLocker {
  private:
   ThreadState *thr_;
   bool locked_;
+
+  SlotLocker(const SlotLocker &) = delete;
+  SlotLocker &operator=(const SlotLocker &) = delete;
 };
 
 class SlotUnlocker {
diff --git a/compiler-rt/lib/tsan/rtl/tsan_vector_clock.h b/compiler-rt/lib/tsan/rtl/tsan_vector_clock.h
index 51d98113d8e78a..5ba69aaf10a574 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_vector_clock.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_vector_clock.h
@@ -35,6 +35,8 @@ class VectorClock {
 
  private:
   VECTOR_ALIGNED Epoch clk_[kThreadSlotCount];
+
+  VectorClock(const VectorClock&) = delete;
 };
 
 ALWAYS_INLINE Epoch VectorClock::Get(Sid sid) const {
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.h b/compiler-rt/lib/ubsan/ubsan_diag.h
index c836647c98f3c5..320962c9c69d3e 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.h
+++ b/compiler-rt/lib/ubsan/ubsan_diag.h
@@ -228,6 +228,9 @@ class ScopedReport {
   Location SummaryLoc;
   ErrorType Type;
 
+  ScopedReport(const ScopedReport &) = delete;
+  ScopedReport &operator=(const ScopedReport &) = delete;
+
 public:
   ScopedReport(ReportOptions Opts, Location SummaryLoc, ErrorType Type);
   ~ScopedReport();
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 55e9903876b1d1..841eaa4693d50f 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -654,6 +654,8 @@ class RuntimeCallInserter {
   Function *OwnerFn = nullptr;
   bool TrackInsertedCalls = false;
   SmallVector<CallInst *> InsertedCalls;
+  RuntimeCallInserter(const RuntimeCallInserter &) = delete;
+  RuntimeCallInserter &operator=(const RuntimeCallInserter &) = delete;
 
 public:
   RuntimeCallInserter(Function &Fn) : OwnerFn(&Fn) {
@@ -829,6 +831,9 @@ struct AddressSanitizer {
       Pass->LocalDynamicShadow = null...
[truncated]

Copy link

github-actions bot commented Oct 18, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-rt:asan Address sanitizer compiler-rt:fuzzer compiler-rt:lsan Leak sanitizer compiler-rt:msan Memory sanitizer compiler-rt:sanitizer compiler-rt:tsan Thread sanitizer compiler-rt:ubsan Undefined behavior sanitizer compiler-rt llvm:transforms PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants