aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-03-25 10:31:49 +0000
committerAlexey Samsonov <samsonov@google.com>2013-03-25 10:31:49 +0000
commitacfb82e611f205c6d609ad59b1779a9bd55cb15d (patch)
tree4097a289c0e47cbfbc9897fe7e141a7be197a51d
parent31a2c483ed1be28071d50f27a76697c600044f03 (diff)
downloadllvm-acfb82e611f205c6d609ad59b1779a9bd55cb15d.zip
llvm-acfb82e611f205c6d609ad59b1779a9bd55cb15d.tar.gz
llvm-acfb82e611f205c6d609ad59b1779a9bd55cb15d.tar.bz2
[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.
llvm-svn: 177860
-rw-r--r--compiler-rt/CMakeLists.txt6
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc3
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h5
3 files changed, 8 insertions, 6 deletions
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 240572e..5ce55bd9 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 5b3dacc..22c7c5e 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 66eb4ca..fde969c 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.