[cfe-commits] r76493 - in /cfe/trunk/lib/CodeGen: CodeGenFunction.cpp CodeGenFunction.h

Fariborz Jahanian fjahanian at apple.com
Mon Jul 20 16:19:52 PDT 2009


Done in: http://llvm.org/viewvc/llvm-project?view=rev&revision=76498

- Thanks, Fariborz

On Jul 20, 2009, at 4:03 PM, Anders Carlsson wrote:

>
> On Jul 20, 2009, at 3:35 PM, Fariborz Jahanian wrote:
>
>> Author: fjahanian
>> Date: Mon Jul 20 17:35:22 2009
>> New Revision: 76493
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=76493&view=rev
>> Log:
>> Early ir-gen for constructor prologue. This is on going.
>>
>
> Very nice!
>
>> +/// EmitCtorPrologue - This routine generates necessary code to  
>> initialize
>> +/// base classes and non-static data members belonging to this  
>> constructor.
>> +void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl  
>> *CD) {
>
> Could you move this function to CGCXX where the rest of the ctor/ 
> dtor stuff lives?
>
>> +  for (CXXConstructorDecl::init_const_iterator B = CD->init_begin(),
>> +       E = CD->init_end();
>> +       B != E; ++B) {
>> +    CXXBaseOrMemberInitializer *Member = (*B);
>> +    if (Member->isBaseInitializer()) {
>> +      // FIXME. Added base initialilzers here.
>> +      ;
>
> I like to add asserts so we don't forget about this.
>
>> +    }
>> +    else {
>> +      // non-static data member initilaizers.
>> +      FieldDecl *Field = Member->getMember();
>> +      QualType FieldType = getContext().getCanonicalType((Field)- 
>> >getType());
>> +      assert(!getContext().getAsArrayType(FieldType)
>> +             && "Field arrays initialization unsupported");
>> +      assert(!FieldType->getAsRecordType()
>> +             && "Field class initialization unsupported");
>
> ... like this :) I also like using FIXME in the assertions so we  
> know that it's something that needs to be fixed.
>
> Anders
>




More information about the cfe-commits mailing list