From a31472def0d7c5e7a41d051428c60c22ad8b182c Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Fri, 11 Sep 2009 22:27:50 +0000 Subject: [PATCH] No need to build the visible conversionfunction list for root class. llvm-svn: 81583 --- clang/lib/AST/DeclCXX.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index e878a3df280d..2149005cde5a 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -288,11 +288,16 @@ void CXXRecordDecl::addedAssignmentOperator(ASTContext &Context, OverloadedFunctionDecl * CXXRecordDecl::getVisibleConversionFunctions(ASTContext &Context, CXXRecordDecl *RD) { - // If visible conversion list is already evaluated, return it. - if (RD == this && - VisibleConversions.function_begin() != VisibleConversions.function_end()) - return &VisibleConversions; - + if (RD == this) { + // If root class, all conversions are visible. + if (RD->bases_begin() == RD->bases_end()) + return &Conversions; + // If visible conversion list is already evaluated, return it. + if (VisibleConversions.function_begin() + != VisibleConversions.function_end()) + return &VisibleConversions; + } + QualType ClassType = Context.getTypeDeclType(this); if (const RecordType *Record = ClassType->getAs()) { OverloadedFunctionDecl *Conversions