[cfe-commits] r77556 - in /cfe/trunk: lib/AST/RecordLayoutBuilder.cpp lib/AST/RecordLayoutBuilder.h lib/CodeGen/CodeGenTypes.cpp test/CodeGenCXX/virt.cpp

Anders Carlsson andersca at mac.com
Wed Jul 29 21:07:25 PDT 2009


>>
>>  // If this is a C++ class, lay out the nonvirtual bases.
>> -  if (Ctx.getLangOptions().CPlusPlus)
>> -    LayoutNonVirtualBases(cast<CXXRecordDecl>(D));
>> +  if (Ctx.getLangOptions().CPlusPlus) {
>> +    const CXXRecordDecl *RD = cast<CXXRecordDecl>(D);
>> +    LayoutVtable(RD);
>> +    LayoutNonVirtualBases(RD);
>
> Why check for c++? Do we get CXXRecordDecl AST in other languages I
> wonder?
>

You don't. You can however get RecordDecls back even in CPlusPlus due  
to Objective-C. I suggest that we always use dyn_cast<CXXRecordDecl> 
(D) instead of checking CPlusPlus.

Anders




More information about the cfe-commits mailing list