[compiler-rt] r177860 - [Sanitizer] Compile sanitizer runtimes with -Wno-non-virtual-dtor. Virtual dtors may be a problem for us, as sanitizer runtime should not generally assume libstdc++ presence.

Alexey Samsonov samsonov at google.com
Mon Mar 25 03:31:49 PDT 2013


Author: samsonov
Date: Mon Mar 25 05:31:49 2013
New Revision: 177860

URL: http://llvm.org/viewvc/llvm-project?rev=177860&view=rev
Log:
[Sanitizer] Compile sanitizer runtimes with -Wno-non-virtual-dtor. Virtual dtors may be a problem for us, as sanitizer runtime should not generally assume libstdc++ presence.

Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.h

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=177860&r1=177859&r2=177860&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Mon Mar 25 05:31:49 2013
@@ -147,6 +147,12 @@ check_cxx_compiler_flag(-Wno-c99-extensi
 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)

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.cc?rev=177860&r1=177859&r2=177860&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.cc Mon Mar 25 05:31:49 2013
@@ -22,11 +22,10 @@ ThreadContextBase::ThreadContextBase(u32
   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';

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.h?rev=177860&r1=177859&r2=177860&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.h Mon Mar 25 05:31:49 2013
@@ -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.





More information about the llvm-commits mailing list