[cfe-commits] r90542 - in /cfe/trunk/lib: AST/DeclCXX.cpp CodeGen/CGVtable.cpp Sema/SemaDecl.cpp
Anders Carlsson
andersca at mac.com
Thu Dec 3 21:51:57 PST 2009
Author: andersca
Date: Thu Dec 3 23:51:56 2009
New Revision: 90542
URL: http://llvm.org/viewvc/llvm-project?rev=90542&view=rev
Log:
Make sure that overridden method decls are always canonical.
Modified:
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/CodeGen/CGVtable.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=90542&r1=90541&r2=90542&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Thu Dec 3 23:51:56 2009
@@ -589,6 +589,8 @@
static OverriddenMethodsMapTy *OverriddenMethods = 0;
void CXXMethodDecl::addOverriddenMethod(const CXXMethodDecl *MD) {
+ assert(MD->isCanonicalDecl() && "Method is not canonical!");
+
// FIXME: The CXXMethodDecl dtor needs to remove and free the entry.
if (!OverriddenMethods)
Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=90542&r1=90541&r2=90542&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Thu Dec 3 23:51:56 2009
@@ -742,7 +742,7 @@
mi != e; ++mi) {
GlobalDecl OGD;
- const CXXMethodDecl *OMD = (*mi)->getCanonicalDecl();
+ const CXXMethodDecl *OMD = *mi;
if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(OMD))
OGD = GlobalDecl(DD, GD.getDtorType());
else
@@ -933,7 +933,7 @@
// Check if this method overrides a method in the primary base.
for (CXXMethodDecl::method_iterator i = MD->begin_overridden_methods(),
e = MD->end_overridden_methods(); i != e; ++i) {
- const CXXMethodDecl *OverriddenMD = (*i)->getCanonicalDecl();
+ const CXXMethodDecl *OverriddenMD = *i;
const CXXRecordDecl *OverriddenRD = OverriddenMD->getParent();
assert(OverriddenMD->isCanonicalDecl() &&
"Should have the canonical decl of the overridden RD!");
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=90542&r1=90541&r2=90542&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Dec 3 23:51:56 2009
@@ -2585,7 +2585,7 @@
if (!CheckOverridingFunctionReturnType(MD, OldMD) &&
!CheckOverridingFunctionExceptionSpec(MD, OldMD) &&
!CheckOverridingFunctionAttributes(MD, OldMD))
- MD->addOverriddenMethod(OldMD);
+ MD->addOverriddenMethod(OldMD->getCanonicalDecl());
}
}
}
More information about the cfe-commits
mailing list