This is an archive of the discontinued LLVM Phabricator instance.

[clang] Fix warning -Wnon-virtual-dtor.
ClosedPublic

Authored by akuegel on Aug 9 2021, 5:36 AM.

Details

Reviewers
bkramer
Summary

When making the emit function virtual, the destructor needs to become
virtual as well.

Diff Detail

Unit TestsFailed

Event Timeline

akuegel requested review of this revision.Aug 9 2021, 5:36 AM
akuegel created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2021, 5:36 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
akuegel retitled this revision from [lldb] Fix warning -Wnon-virtual-dtor. to [clang] Fix warning -Wnon-virtual-dtor..Aug 9 2021, 5:43 AM
bkramer accepted this revision.Aug 9 2021, 5:49 AM

thanks

This revision is now accepted and ready to land.Aug 9 2021, 5:49 AM
Quuxplusone added inline comments.
clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
311

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.

MaskRay closed this revision.Aug 9 2021, 9:16 AM