Add a default virtual dtor to Pass and check for missing virtual dtors
authorJean-Francois Roy <jfroy@google.com>
Tue, 28 Feb 2017 19:34:18 +0000 (11:34 -0800)
committerDavid Neto <dneto@google.com>
Wed, 1 Mar 2017 18:34:04 +0000 (13:34 -0500)
CMakeLists.txt
source/opt/pass.h

index 7765caf..214ff91 100644 (file)
@@ -50,7 +50,7 @@ if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MAT
   set(COMPILER_IS_LIKE_GNU TRUE)
 endif()
 if(${COMPILER_IS_LIKE_GNU})
-  set(SPIRV_WARNINGS -Wall -Wextra -Wno-missing-field-initializers)
+  set(SPIRV_WARNINGS -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers)
 
   option(SPIRV_WARN_EVERYTHING "Enable -Weverything" ${SPIRV_WARN_EVERYTHING})
   if(${SPIRV_WARN_EVERYTHING})
index 6e5df74..74e3bb8 100644 (file)
@@ -44,6 +44,9 @@ class Pass {
   // one if messages are of concern.
   Pass() : consumer_(nullptr) {}
 
+  // Destructs the pass.
+  virtual ~Pass() = default;
+
   // Returns a descriptive name for this pass.
   virtual const char* name() const = 0;