This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: help with front end and scopes


On April 12, 2017 10:24:31 AM GMT+02:00, Andre Groenewald <adres.is.gevat@gmail.com> wrote:
>I am a bit stuck on global, file and local name spaces and scopes.
>
>Normally my expression bindings is associated with a function, which
>makes the function the scope of all the variables.
>
>my front end can parse something like this:
>
>int testfunc(int parmVar)
>{
>  int testfuncVar;
>}
>
>int testfunc2(int funcVar)
>{
>  int testfuncVar2;
>}
>
>Every function is individually gimplified and added and finalized.
>Everything is chained and bind correctly.
>
>parser->Fndecl = build_fn_decl(functionName, fnDeclType);
>....
>gimplify_function_tree(parser->Fndecl);
>cgraph_node::finalize_function(parser->Fndecl, true);
>
>I want to expand my front end to something like this:
>
>module TestModule
>{
>  int moduleVariable;
>  class TestClass
>  {
>    int classVariable;
>    int testfunc(int parmVar)
>    {
>      int testfuncVar;
>    }
>  }
>}
>
>The question is what should TestModule be declared as, what tree type
>or declaration function, and also TestClass. How should TestModule be
>gimplified and then finalized.

TestModule should be context of TestClass which should be context of testFunc which is the only thing gimplified.

For TestModule you have the choice of NAMESPACE_DECL and TRANSLATION_UNIT_DECL.

Richard.

>Thank you
>André


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]