From: John McCall Date: Tue, 3 Nov 2009 19:33:12 +0000 (+0000) Subject: Silence a warning by giving Parser::FieldCallback a virtual destructor, and X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6c94a6d77f456f23ecd4c2061e6413786b5e6571;p=clang Silence a warning by giving Parser::FieldCallback a virtual destructor, and anchor the vtable to Parser.cpp for good measure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85927 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 14dc8f8e36..3849f9d0d5 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -983,6 +983,10 @@ private: struct FieldCallback { virtual DeclPtrTy invoke(FieldDeclarator &Field) = 0; + virtual ~FieldCallback() {} + + private: + virtual void _anchor(); }; void ParseStructDeclaration(DeclSpec &DS, FieldCallback &Callback); diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index e69cb72a0a..cc4aec6297 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -1019,3 +1019,10 @@ bool Parser::TryAnnotateCXXScopeToken(bool EnteringContext) { PP.AnnotateCachedTokens(Tok); return true; } + +// Anchor the Parser::FieldCallback vtable to this translation unit. +// We use a spurious method instead of the destructor because +// destroying FieldCallbacks can actually be slightly +// performance-sensitive. +void Parser::FieldCallback::_anchor() { +}