From: David Majnemer Date: Tue, 15 Jul 2014 04:30:17 +0000 (+0000) Subject: AST: Don't walk all redeclarations when looking for a uuid attr X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03f233fc907f6020cd8baa653c81e3201ffdfbac;p=clang AST: Don't walk all redeclarations when looking for a uuid attr No funcionality changed, just a simplification of the existing code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213044 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index c127b4a1dc..54b043c3d5 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -64,17 +64,15 @@ const UuidAttr *CXXUuidofExpr::GetUuidAttrOfType(QualType QT, else if (QT->isArrayType()) Ty = Ty->getBaseElementTypeUnsafe(); - CXXRecordDecl *RD = Ty->getAsCXXRecordDecl(); + const CXXRecordDecl *RD = Ty->getAsCXXRecordDecl(); if (!RD) return nullptr; - // Loop over all record redeclarations looking for a uuid attribute. - for (const TagDecl *I : RD->redecls()) - if (const UuidAttr *Uuid = I->getAttr()) - return Uuid; + if (const UuidAttr *Uuid = RD->getMostRecentDecl()->getAttr()) + return Uuid; // __uuidof can grab UUIDs from template arguments. - if (ClassTemplateSpecializationDecl *CTSD = + if (const ClassTemplateSpecializationDecl *CTSD = dyn_cast(RD)) { const TemplateArgumentList &TAL = CTSD->getTemplateArgs(); const UuidAttr *UuidForRD = nullptr;