Delete assert in ComputeKeyFunction. The function runs fine without it, since

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.

llvm-svn: 107143
This commit is contained in:
Jeffrey Yasskin 2010-06-29 15:27:35 +00:00
parent 17f1ca8793
commit bb219e01a6
2 changed files with 3 additions and 4 deletions

View 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.

View 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;