summaryrefslogtreecommitdiff
path: root/src/ToolBox
diff options
context:
space:
mode:
authorOmair Majid <omajid@redhat.com>2019-06-07 16:49:52 -0400
committerJan Vorlicek <janvorli@microsoft.com>2019-06-07 22:49:52 +0200
commit3fcaf0373369ed4b17bd1ed068592c2e0cec3997 (patch)
treea751b81233e46f1163ffd2bacf31697cea72231c /src/ToolBox
parentb314ed86b11756834b0936e56c3d841e7407f81d (diff)
downloadcoreclr-3fcaf0373369ed4b17bd1ed068592c2e0cec3997.tar.gz
coreclr-3fcaf0373369ed4b17bd1ed068592c2e0cec3997.tar.bz2
coreclr-3fcaf0373369ed4b17bd1ed068592c2e0cec3997.zip
Do not delete polymorphic objects without a virtual destructor (#23705)
SEI CERT C++ Coding Standard says: > Do not delete an object of derived class type through a pointer to its > base class type that has a non-virtual destructor. Instead, the base > class should be defined with a virtual destructor. Deleting an object > through a pointer to a type without a virtual destructor results in > undefined behavior. See https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP52-CPP.+Do+not+delete+a+polymorphic+object+without+a+virtual+destructor Clang generally warns about this, but we disabled the warning via -Wno-delete-non-virtual-dtor. This commit re-enables the warning and fixes up all the code that hits the warning.
Diffstat (limited to 'src/ToolBox')
-rw-r--r--src/ToolBox/SOS/lldbplugin/CMakeLists.txt2
-rw-r--r--src/ToolBox/SOS/lldbplugin/inc/lldbservices.h1
-rw-r--r--src/ToolBox/SOS/lldbplugin/services.h2
3 files changed, 2 insertions, 3 deletions
diff --git a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
index fadb37469a..6a279edc8a 100644
--- a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
+++ b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
@@ -124,8 +124,6 @@ endif()
message(STATUS "LLDB_H: ${LLDB_H}")
-add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-delete-non-virtual-dtor>)
-
include_directories(inc)
include_directories("${LLDB_H}")
include_directories(${CLR_DIR}/src/debug/inc)
diff --git a/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h b/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h
index ffb22242d0..7bb9b1aca3 100644
--- a/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h
+++ b/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h
@@ -237,6 +237,7 @@ MIDL_INTERFACE("2E6C569A-9E14-4DA4-9DFC-CDB73A532566")
ILLDBServices : public IUnknown
{
public:
+
//----------------------------------------------------------------------------
// ILLDBServices
//----------------------------------------------------------------------------
diff --git a/src/ToolBox/SOS/lldbplugin/services.h b/src/ToolBox/SOS/lldbplugin/services.h
index 650904002c..a8fb32f89f 100644
--- a/src/ToolBox/SOS/lldbplugin/services.h
+++ b/src/ToolBox/SOS/lldbplugin/services.h
@@ -26,7 +26,7 @@ private:
public:
LLDBServices(lldb::SBDebugger &debugger, lldb::SBCommandReturnObject &returnObject, lldb::SBProcess *process = nullptr, lldb::SBThread *thread = nullptr);
- ~LLDBServices();
+ virtual ~LLDBServices();
//----------------------------------------------------------------------------
// IUnknown