[cfe-commits] [PATCH] Delete assert in ComputeKeyFunction (issue1746042)
jyasskin at gmail.com
jyasskin at gmail.com
Mon Jun 28 15:40:29 PDT 2010
Reviewers: cfe-commits_cs.uiuc.edu,
Message:
Chandler suggested I run this by you guys.
Description:
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.
Please review this at http://codereview.appspot.com/1746042/show
Affected files:
M include/clang/AST/ASTContext.h
M lib/AST/RecordLayoutBuilder.cpp
Index: include/clang/AST/ASTContext.h
===================================================================
--- include/clang/AST/ASTContext.h (revision 107075)
+++ include/clang/AST/ASTContext.h (working copy)
@@ -976,8 +976,9 @@
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: lib/AST/RecordLayoutBuilder.cpp
===================================================================
--- lib/AST/RecordLayoutBuilder.cpp (revision 107075)
+++ lib/AST/RecordLayoutBuilder.cpp (working copy)
@@ -1415,8 +1415,6 @@
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;
More information about the cfe-commits
mailing list