[cfe-commits] r72591 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp lib/CodeGen/CGCXX.cpp lib/CodeGen/CodeGenFunction.h lib/CodeGen/CodeGenModule.cpp
Douglas Gregor
dgregor at apple.com
Fri May 29 23:01:12 PDT 2009
On May 29, 2009, at 2:03 PM, Anders Carlsson wrote:
> +const CXXDestructorDecl *
> +CXXRecordDecl::getDestructor(ASTContext &Context) {
> + QualType ClassType = Context.getTypeDeclType(this);
You should grab the canonical type here (ClassType =
Context.getCanonicalType(ClassType)), lest our search for a destructor
fail.
> + DeclarationName Name
> + = Context.DeclarationNames.getCXXDestructorName(ClassType);
> +
> + DeclContext::lookup_iterator I, E;
> + llvm::tie(I, E) = lookup(Context, Name);
> + assert(I != E && "Did not find a destructor!");
> +
> + const CXXDestructorDecl *Dtor = cast<CXXDestructorDecl>(*I);
> + assert(++I == E && "Found more than one destructor!");
> +
> + return Dtor;
> +}
Looks good.
- Doug
More information about the cfe-commits
mailing list