AST: Don't walk all redeclarations when looking for a uuid attr

No funcionality changed, just a simplification of the existing code.

llvm-svn: 213044
This commit is contained in:
David Majnemer 2014-07-15 04:30:17 +00:00
parent 5e9e56a0a1
commit 6d4766535f
1 changed files with 4 additions and 6 deletions

View File

@ -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<UuidAttr>())
return Uuid;
if (const UuidAttr *Uuid = RD->getMostRecentDecl()->getAttr<UuidAttr>())
return Uuid;
// __uuidof can grab UUIDs from template arguments.
if (ClassTemplateSpecializationDecl *CTSD =
if (const ClassTemplateSpecializationDecl *CTSD =
dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
const TemplateArgumentList &TAL = CTSD->getTemplateArgs();
const UuidAttr *UuidForRD = nullptr;