[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-dev] Creating a New Structure with ASTRewrite
|
Hi everytime I try to create a new structure using ASTRewrite it reports in
initStatus that an unexpected error has occured while creating a Change
object. Does this occur because the AST writer expects an
IASTSimpleDeclSpecifier rather than an IASTCompositeTypeSpecifier? It's
fustrating because if I just use a IASTSimpleDeclSpecifier the changes are
able to be generated.
I've shortened and clarified the code to the following:
IASTSimpleDeclaration struct = new CASTSimpleDeclaration();
IASTDeclarator decl = new CASTDeclarator(new
CASTName(info.getName().toCharArray()));
struct.addDeclarator(decl);
ICASTCompositeTypeSpecifier declSpec = new CASTCompositeTypeSpecifier();
declSpec.setKey(1);
declSpec.setStorageClass(1);
struct.setDeclSpecifier(declSpec);
ASTRewrite rewrite = collector.rewriterForTranslationUnit(unit);
rewrite.insertBefore(unit,
TranslationUnitHelper.getFirstNode(unit),
prototype,
new TextEditGroup ("Structure insertion"));
Thanks alot in advance
--
View this message in context: http://www.nabble.com/Creating-a-New-Structure-with-ASTRewrite-tp17455815p17455815.html
Sent from the Eclipse CDT - Development mailing list archive at Nabble.com.