From 6a2b51482608ca8e7416c7d573e487f52b04c054 Mon Sep 17 00:00:00 2001 From: Jean-Francois Roy Date: Tue, 28 Feb 2017 11:34:18 -0800 Subject: [PATCH] Add a default virtual dtor to Pass and check for missing virtual dtors --- CMakeLists.txt | 2 +- source/opt/pass.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7765caf..214ff91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/source/opt/pass.h b/source/opt/pass.h index 6e5df74..74e3bb8 100644 --- a/source/opt/pass.h +++ b/source/opt/pass.h @@ -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; -- 2.7.4