From 37de611c0f4deb72ac85aac4381622cd355bdd26 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 14 Jul 2014 23:40:24 +0000 Subject: AST: Fix __uuidof for template specializations While we previously supported __uuidof applied to a template specialization, we would only find the uuid attribute if it was applied to the template argument. We would erroneously ignore the uuid attribute on the specialization itself. This is required to parse Windows Runtime C++ Template Library headers. llvm-svn: 213016 --- clang/lib/AST/ExprCXX.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'clang/lib') diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index 31bf432cf9f..c127b4a1dc0 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -68,6 +68,11 @@ const UuidAttr *CXXUuidofExpr::GetUuidAttrOfType(QualType QT, 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; + // __uuidof can grab UUIDs from template arguments. if (ClassTemplateSpecializationDecl *CTSD = dyn_cast(RD)) { @@ -106,11 +111,6 @@ const UuidAttr *CXXUuidofExpr::GetUuidAttrOfType(QualType QT, return UuidForRD; } - // Loop over all record redeclarations looking for a uuid attribute. - for (const TagDecl *I : RD->redecls()) - if (const UuidAttr *Uuid = I->getAttr()) - return Uuid; - return nullptr; } -- cgit v1.2.3