From: Tim Keith Date: Thu, 6 Aug 2020 01:03:40 +0000 (-0700) Subject: [flang] Fix compilation warning in check-directive-structure.h X-Git-Tag: llvmorg-13-init~15617 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d2d73059fda5a63f2b34a9482acc0445e0956a4;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/flang/lib/Semantics/check-directive-structure.h b/flang/lib/Semantics/check-directive-structure.h index a5de056..6755e47 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} {}