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

Fariborz Jahanian fjahanian at apple.com
Tue Jul 28 17:47:11 PDT 2009


On Jul 28, 2009, at 3:48 PM, Fariborz Jahanian wrote:

>
> On Jul 28, 2009, at 3:15 PM, Chris Lattner wrote:
>>>
>>>   CVRQualifiers = PTy->getPointeeType().getCVRQualifiers();
>>> +    if (CXXThisExpr *ThisExpr = dyn_cast<CXXThisExpr>(BaseExpr)) {
>>> +      QualType ClassTy = ThisExpr->getType();
>>> +      ClassTy = ClassTy->getPointeeType();
>>> +      CXXRecordDecl *ClassDecl =
>>> +        cast<CXXRecordDecl>(ClassTy->getAsRecordType()->getDecl());
>>
>> I'm seeing a lot of this sort of code.  Can you add a method on
>> Type, something like "getCXXRecordDeclForPointerType()" that returns
>> a CXXRecordDecl if the type is a pointer to record type?
>>
>> It would basically be:
>>
>> if (PointerType *PT = X->getAsPointerType())
>>   if (RecordType *RT = PT->getPointeeType()->getAsRecordType())
>>     return dyn_cast<CXXRecordDecl>(RT);
>> return 0;
>>
>
> Good idea. Will do so shortly.

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

- Fariborz

>
>
> - Fariborz
>
>> Please make use of this helper in various other places, it seems
>> that it could significantly simplify a lot of the code you've been
>> working on lately.
>>
>> -Chris
>>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list