Hi,<br><br>I'm attempting to write a code generator that adds in additional classes and global instances of those classes upon discovery of a pragma statement. This is happening in the Parser, calling the appropriate Sema actions to create and insert these into the AST on the fly.<br>
<br>I have it generating both the class and instances and inserting them both into the AST, however when it comes to code generation it complains that it cannot emit a local variable declaration as a global one. Some further looking into things show that my instance declaration returns false when isFileVarDecl() is called, I think indicating that it hasn't been declared in a FileContext. Could this be a problem with my Class Declaration or is it more likely to be my actual Instance Declaration causing this.<br>
<br>One thing I'm suspicious of is that the actions for these declarations are being called halfway through parsing a function, however I have been using completely separate DeclSpec's and ParsingDeclarators for this and am passing the decl's created up the chain to a point before the function decl is used. Could the context during function creation be causing the problem? I'm having trouble getting my head around all the different contexts that are passed around and how they are used..<br>
<br>I can provide more info and code if that'll help..<br><br>Thanks,<br><br>Dan<br><br clear="all"><br>-- <br>--------<br>Daniel Powell<br><a href="mailto:divot.powell@googlemail.com" target="_blank">divot.powell@googlemail.com</a><br>
<a href="http://tinyurl.com/powelld" target="_blank">http://tinyurl.com/powelld</a><br><br>The University of Edinburgh<br>Institute for Computer Systems Architecture<br>