[cfe-commits] r131066 - /cfe/trunk/lib/Sema/SemaExprCXX.cpp

Douglas Gregor dgregor at apple.com
Mon May 9 12:00:50 PDT 2011


On May 8, 2011, at 3:02 AM, Francois Pichet wrote:

> Author: fpichet
> Date: Sun May  8 05:02:20 2011
> New Revision: 131066
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=131066&view=rev
> Log:
> Look at all the record redeclaration when looking for a uuid attribute.
> 
> Modified:
>    cfe/trunk/lib/Sema/SemaExprCXX.cpp
> 
> Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=131066&r1=131065&r2=131066&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sun May  8 05:02:20 2011
> @@ -385,13 +385,14 @@
>   else if (QT->isArrayType())
>     Ty = cast<ArrayType>(QT)->getElementType().getTypePtr();
> 
> -  // Loop all class definition and declaration looking for an uuid attribute.
> +  // Loop all record redeclaration looking for an uuid attribute.
>   CXXRecordDecl *RD = Ty->getAsCXXRecordDecl();
> -  while (RD) {
> -    if (UuidAttr *Uuid = RD->getAttr<UuidAttr>())
> +  for (CXXRecordDecl::redecl_iterator I = RD->redecls_begin(),
> +       E = RD->redecls_end(); I != E; ++I) {
> +    if (UuidAttr *Uuid = I->getAttr<UuidAttr>())
>       return Uuid;
> -    RD = RD->getPreviousDeclaration();
>   }
> +
>   return 0;
> }


Usually, we merge attributes from prior declarations to later declarations, so that we don't need to perform walks over all redeclarations. That would be a better solution, unless you're seeing a case where MSVC is allowing us to pick up a UUID attribute from a later declaration?

	- Doug



More information about the cfe-commits mailing list