[cfe-commits] r62326 - /cfe/trunk/lib/CodeGen/CGExprScalar.cpp

Chris Lattner clattner at apple.com
Fri Jan 16 10:19:51 PST 2009


On Jan 16, 2009, at 9:41 AM, Fariborz Jahanian wrote:

> Author: fjahanian
> Date: Fri Jan 16 11:41:13 2009
> New Revision: 62326
>
> URL: http://llvm.org/viewvc/llvm-project?rev=62326&view=rev
> Log:
> Used a more suitable api to get to the type of a record
> in code gen.

Thanks Fariborz,

There are a couple of things I'm still missing though:

     const Type *Key =
       CGF.getContext().getTagDeclType(
                      
const_cast<TagDecl*>(dyn_cast<TagDecl>(RD))).getTypePtr();
     TypeToSize = QualType(Key->getAsRecordType(), 0);

dyn_cast should only be used when the operand may not be the specified  
type.  Use cast if you know it is a tag decl.

Also, I don't think that you need to call getAsRecordType there.   
"QualType(Key, 0)" should work just as well.  Finally, you're  
converting from a qualtype to a type to a qualtype, won't this work?:

     TypeToSize =   
CGF.getContext().getTagDeclType(const_cast<TagDecl*>(RD));

-Chris



More information about the cfe-commits mailing list