[cfe-commits] r77351 - in /cfe/trunk: lib/CodeGen/CGCXX.cpp lib/CodeGen/CGExpr.cpp test/CodeGenCXX/constructor-init.cpp

Chris Lattner clattner at apple.com
Tue Jul 28 15:04:27 PDT 2009


On Jul 28, 2009, at 11:54 AM, Fariborz Jahanian wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=77351&view=rev
> Log:
> More cleanup of data member access and then some.

Ok

> +++ cfe/trunk/lib/CodeGen/CGCXX.cpp Tue Jul 28 13:54:57 2009
> @@ -168,16 +168,23 @@
>   getContext().getASTRecordLayout(ClassDecl);
>   llvm::Type *I8Ptr =  
> VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
>   unsigned Idx = 0;
> +  bool DerivedToBaseConversion = false;
>   for (CXXRecordDecl::base_class_const_iterator i =
>          ClassDecl->bases_begin(),
>          e = ClassDecl->bases_end(); i != e; ++i, ++Idx) {
>     if (!i->isVirtual()) {
>         const CXXRecordDecl *Base =
>         cast<CXXRecordDecl>(i->getType()->getAsRecordType()- 
> >getDecl());
> -        if (Base == BaseClassDecl)
> -          break;
> +      if (Base == BaseClassDecl) {
> +        DerivedToBaseConversion = true;
> +        break;
> +      }
>     }
>   }

Can you convert this loop to be a static function instead?   
Justification here:
http://llvm.org/docs/CodingStandards.html#hl_predicateloops

Thanks,

-Chris




More information about the cfe-commits mailing list