diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 240572e300f6..5ce55bd9f5f6 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -147,6 +147,12 @@ check_cxx_compiler_flag(-Wno-c99-extensions SUPPORTS_NO_C99_EXTENSIONS_FLAG) if(SUPPORTS_NO_C99_EXTENSIONS_FLAG) list(APPEND SANITIZER_COMMON_CFLAGS -Wno-c99-extensions) endif() +# Sanitizer may not have libstdc++, so we can have problems with virtual +# destructors. +check_cxx_compiler_flag(-Wno-non-virtual-dtor SUPPORTS_NO_NON_VIRTUAL_DTOR_FLAG) +if (SUPPORTS_NO_NON_VIRTUAL_DTOR_FLAG) + list(APPEND SANITIZER_COMMON_CFLAGS -Wno-non-virtual-dtor) +endif() # Setup min Mac OS X version. if(APPLE) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc index 5b3dacc56142..22c7c5e19679 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc @@ -22,11 +22,10 @@ ThreadContextBase::ThreadContextBase(u32 tid) name[0] = '\0'; } -#ifndef SANITIZER_GO ThreadContextBase::~ThreadContextBase() { + // ThreadContextBase should never be deleted. CHECK(0); } -#endif void ThreadContextBase::SetName(const char *new_name) { name[0] = '\0'; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h index 66eb4ca184e9..fde969c6c5fa 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h @@ -34,10 +34,7 @@ enum ThreadStatus { class ThreadContextBase { public: explicit ThreadContextBase(u32 tid); -#ifndef SANITIZER_GO // Go does not have libstdc++ - virtual -#endif - ~ThreadContextBase(); + ~ThreadContextBase(); // Should never be called. const u32 tid; // Thread ID. Main thread should have tid = 0. u64 unique_id; // Unique thread ID.