[cfe-commits] r85927 - in /cfe/trunk: include/clang/Parse/Parser.h lib/Parse/Parser.cpp
John McCall
rjmccall at apple.com
Tue Nov 3 11:33:12 PST 2009
Author: rjmccall
Date: Tue Nov 3 13:33:12 2009
New Revision: 85927
URL: http://llvm.org/viewvc/llvm-project?rev=85927&view=rev
Log:
Silence a warning by giving Parser::FieldCallback a virtual destructor, and
anchor the vtable to Parser.cpp for good measure.
Modified:
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/Parse/Parser.cpp
Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=85927&r1=85926&r2=85927&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Tue Nov 3 13:33:12 2009
@@ -983,6 +983,10 @@
struct FieldCallback {
virtual DeclPtrTy invoke(FieldDeclarator &Field) = 0;
+ virtual ~FieldCallback() {}
+
+ private:
+ virtual void _anchor();
};
void ParseStructDeclaration(DeclSpec &DS, FieldCallback &Callback);
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=85927&r1=85926&r2=85927&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Tue Nov 3 13:33:12 2009
@@ -1019,3 +1019,10 @@
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() {
+}
More information about the cfe-commits
mailing list