]> granicus.if.org Git - clang/commitdiff
Silence a warning by giving Parser::FieldCallback a virtual destructor, and
authorJohn McCall <rjmccall@apple.com>
Tue, 3 Nov 2009 19:33:12 +0000 (19:33 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 3 Nov 2009 19:33:12 +0000 (19:33 +0000)
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

include/clang/Parse/Parser.h
lib/Parse/Parser.cpp

index 14dc8f8e3695dd63eb04e6332ae4c5bc4de8f2f9..3849f9d0d5c1d1e47f5a7328a52875f3f67f9f87 100644 (file)
@@ -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);
index e69cb72a0a08d894c65b85b8429a818a5893c6f0..cc4aec6297f87c2533c6d8ec54e3c675ed5c653d 100644 (file)
@@ -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() {
+}