<html>
<head></head>
<body>
<p>Hi,<br /><br />I've been quite a while trying to change the access specifier of a FieldDecl. I thought doing this wouldn't be difficult as I found the method setAccess() in class Decl.<br />For instance, I tried:<br/>
<br />field->setAccess(AS_public);<br/>
<br />But it didn't work. I suppose I can't change the access specifier of an entire block of members, but maybe I was expecting that field with a new access specifier out of the block in which it was. I tried then to create a copy of the field and add a new declaration in the recordDecl with addDecl:<br/>
<br />record->addDecl(field);<br/>
<br />This didn't suppose any change and the execution "froze" after finding the first field. Maybe, in this cases when no text is removed or inserted, I am not using correctly the class Rewrite:<br/>
<br />const RewriteBuffer *RewriteBuf = Rewrite.getRewriteBufferFor(FullLocation.getFileID());<br /><br />Finally, I tried to directly insert the field as text:<br/>
<br />string("\npublic:\n"+field->getType().getAsString()+" "+ field->getNameAsString()+";\n");<br/>
<br />But then I realize that I didn't know how to keep the modifiers (const, mutable...) of the field. I have found "Attrs" in Decl, but I'm not pretty sure about what is exactly an "Attr" and how can I get these "Attrs" as strings.<br /><br />As you can see, I am a bit lost and I need a bit of help to clarify all this.<br /><br />Thanks,<br /><br />Pedro.</p>
</body>
</html>