From 6d2d73059fda5a63f2b34a9482acc0445e0956a4 Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Wed, 5 Aug 2020 18:03:40 -0700 Subject: [PATCH] [flang] Fix compilation warning in check-directive-structure.h Clang 9 gets the following warning after revision `D85104`. ``` ../../flang/lib/Semantics/check-directive-structure.h:36:7: error: 'Fortran::semantics::DirectiveStructureChecker' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor] ``` The fix is the make the destructor virtual. Neither it nor the constructor need to be public, so make them protected. Differential Revision: https://reviews.llvm.org/D85383 --- flang/lib/Semantics/check-directive-structure.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flang/lib/Semantics/check-directive-structure.h b/flang/lib/Semantics/check-directive-structure.h index a5de0564677cf..6755e475832ac 100644 --- a/flang/lib/Semantics/check-directive-structure.h +++ b/flang/lib/Semantics/check-directive-structure.h @@ -34,13 +34,13 @@ template struct DirectiveClauses { // typename PC is the parser class defined in parse-tree.h for the clauses. template class DirectiveStructureChecker : public virtual BaseChecker { -public: +protected: DirectiveStructureChecker(SemanticsContext &context, std::unordered_map> directiveClausesMap) : context_{context}, directiveClausesMap_(directiveClausesMap) {} + virtual ~DirectiveStructureChecker() {} -protected: struct DirectiveContext { DirectiveContext(parser::CharBlock source, D d) : directiveSource{source}, directive{d} {}