[PATCH] D107760: [clang] Fix warning -Wnon-virtual-dtor.

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 9 06:37:58 PDT 2021


Quuxplusone added inline comments.


================
Comment at: clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp:311
       : OpenCLBuiltinFileEmitterBase(Records, OS) {}
+  virtual ~OpenCLBuiltinTestEmitter() = default;
 
----------------
Tip: When you're putting a defaulted virtual destructor in a derived class "just to make sure the base class's dtor was virtual," I recommend doing it with the `override` keyword:

    ~OpenCLBuiltinTestEmitter() override = default;

This way, if the base class dtor was somehow //not// virtual, then you'll get a nice compiler error.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107760/new/

https://reviews.llvm.org/D107760



More information about the cfe-commits mailing list