forked from OSchip/llvm-project
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:
parent
5e9e56a0a1
commit
6d4766535f
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue