<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Thanks. I still have a problem.<br><br>I modified the field processing in this way:<br>void AAPConsumer::HandleRecordFields(const RecordDecl *RD)<br>{<br> Type *T;<br> for (RecordDecl::field_iterator I = RD->field_begin(),<br> E = RD->field_end(); I != E; I++) {<br> T = ((*I)->getType()).getTypePtr();<br> if (ArrayType::classof(T)) {<br> llvm::errs() << "Field: "; (*I)->dump(); T->dump();<br> llvm::errs() << " ";
(*I)->dump();<br> (*I)->getTypeSourceInfo()->getTypeLoc().getTypePtr()->dump();<br> }<br> }<br>}<br><br>For the field bitcounter, I get following output:<br>Field: int bitcounter[8]: int identifier[8]<br> int bitcounter[8]: int identifier[8]<br><br>In both cases the array size is shown as 8 and the type is ConstantArrayType. I still don't get size MAX_BITCOUNTER_MB. Am I doing something wrong?<br><br>Thanks,<br>Murat<br><br>--- On <b>Mon, 8/23/10, Douglas Gregor <i><dgregor@apple.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Douglas Gregor <dgregor@apple.com><br>Subject: Re: [cfe-dev] Array with size of an Enum Constant<br>To: "Murat B" <murat8307@yahoo.com><br>Cc:
cfe-dev@cs.uiuc.edu<br>Date: Monday, August 23, 2010, 1:23 PM<br><br><div id="yiv696211825"><br><div><div>On Aug 23, 2010, at 10:23 AM, Murat B wrote:</div><br class="yiv696211825Apple-interchange-newline"><blockquote type="cite"><table style="" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">Thanks for the reply Doug!<br><br>I have following situation, I have a variable T of class Type which is the type of the array size expression.<br><br>My function progress following way.<br>ArrayType *AT = dyn_cast<ArrayType>(T);<br>if (VariableArrayType::classof(AT)<br> ......................<br>else if (ConstantArrayType::classof(AT) {<br> ConstantArrayType *CAT = cast<ConstantArrayType>(AT);<br>}<br><br>For the structure field the type will be ConstantArrayType. Can you tell me how I can get TypeSourceInfo from it.<br></td></tr></tbody></table></blockquote></div><br><div>As I
said before, you need to get the TypeSourceInfo from the *field*, i.e., the FieldDecl.</div><div><br></div><div><span class="yiv696211825Apple-tab-span" style="white-space: pre;"> </span>- Doug</div></div></blockquote></td></tr></table><br>