Hello Rick, Since nobody responded, I'll try. :-)
rick shelton <thatrick...@yahoo.com> a écrit: > How does the compiler handle an in-class function definition? > Example: > > // File A.h > > class A { > int foo(void) { return x; } > int bar(void); > int x; > > } > > // File A.cc > #include "A.h" > int A::bar(void) { ... } > > How is "foo()" represented in the AST when parsing A.cc? Let's say the type "A" is represented by type_a. Foo is then represented by a FUNCTION_DECL tree node that is accessible from the list of methods of type_a, that you can get from TYPE_METHODS (type_a). You can walk these methods by doing: { /* method is going to be a tree node of FUNCTION_DECL kind. */ tree method; for (method = TYPE_METHOD (type_a); method; method = DECL_CHAIN (method)) /* Do something with method*/; } Then the body of the function can be accessed from the DECL_INITIAL (method) accessor. I hope this helps. -- Dodji