[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:47:40 PDT 2009
On Jul 28, 2009, at 3:46 PM, Fariborz Jahanian wrote:
>>>
>>> +++ 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
>
> This code will all likelihood change when Anders has the type layout
> change done.
> Base class offset calculation is based on the current layout and
> will be replaced soon.
This code seems like a generally useful predicate. Isn't there other
places in the compiler that compute the same thing?
-Chris
More information about the cfe-commits
mailing list