]> granicus.if.org Git - clang/commitdiff
Delete assert in ComputeKeyFunction. The function runs fine without it, since
authorJeffrey Yasskin <jyasskin@google.com>
Tue, 29 Jun 2010 15:27:35 +0000 (15:27 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Tue, 29 Jun 2010 15:27:35 +0000 (15:27 +0000)
there's an explicit guard on isPolymorphic, and virtual bases don't affect the
key function calculation.  This allows people to call
ASTContext::getKeyFunction on arbitrary classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107143 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ASTContext.h
lib/AST/RecordLayoutBuilder.cpp

index 7291de1c4e38d56033827936e5f9a24cd127749e..3ccdede8e6d8a6b946da4fd003d7961df7006434 100644 (file)
@@ -976,8 +976,9 @@ public:
   const ASTRecordLayout &
   getASTObjCImplementationLayout(const ObjCImplementationDecl *D);
 
-  /// getKeyFunction - Get the key function for the given record decl. 
-  /// The key function is, according to the Itanium C++ ABI section 5.2.3:
+  /// getKeyFunction - Get the key function for the given record decl, or NULL
+  /// if there isn't one.  The key function is, according to the Itanium C++ ABI
+  /// section 5.2.3:
   ///
   /// ...the first non-pure virtual function that is not inline at the point
   /// of class definition.
index 1f04cb80e1309b6e267fb4c39df1383c64fd1705..275daf6bb22b57c62b0f3245a09e96c1426c5a43 100644 (file)
@@ -1415,8 +1415,6 @@ void RecordLayoutBuilder::UpdateAlignment(unsigned NewAlignment) {
 
 const CXXMethodDecl *
 RecordLayoutBuilder::ComputeKeyFunction(const CXXRecordDecl *RD) {
-  assert(RD->isDynamicClass() && "Class does not have any virtual methods!");
-
   // If a class isn't polymorphic it doesn't have a key function.
   if (!RD->isPolymorphic())
     return 0;