How does C++ support create class declarations?

Andreas Pakulat apaku at gmx.de
Mon Feb 18 20:56:12 UTC 2008


On 18.02.08 20:57:52, David Nolden wrote:
> On Monday 18 February 2008 19:47:16 Andreas Pakulat wrote:
> > I've got the following DUChain:
> > kdevelop(14055)/kdevelop (python support) Python::DumpChain::dump: "" New
> > Context  "" [ (0, 0)  ->  (23, 0) ]   top-context kdevelop(14055)/kdevelop
> > (python support) Python::DumpChain::dump: "  " New Context  "Bar" [ (0, 0) 
> > ->  (2, 1) ] kdevelop(14055)/kdevelop (python support)
> > Python::DumpChain::dump: "    " Declaration:  "<notype> "  [ "Bar::" ]  
> > 0x844ef20 (internal ctx 0x0 ) [ (0, 6)  ->  (0, 9) ] ,  defined,  0 use(s)
> >
> > i.e. there's a Context with localScopeIdentifier "Bar" and inside that
> > the class declaration and following that would be the body statements.
> >
> > Or should the Declaration be in the top context and there should be a
> > context just for the body with the localScopeIdentifier "Bar"?
> >
> > Andreas
> 
> I think it should be like this:
> 
> Context  "" [ (0, 0)  ->  (23, 0) ]   top-context 
>  Context  "Bar" id 0x1 [ (0, 0)  ->  (2, 1) ] 
>  Declaration "Bar" (internal ctx 0x1)

I know I'm a PITA and everything, but would you mind explaining this:

kdevelop(31278)/kdevelop (cpp support) CPPInternalParseJob::run: ================== duchain ==================
kdevelop(31278)/kdevelop (cpp support) DumpChain::visit: "" \ TranslationUnit [( 1 ) (0, 0) ] ""class Foo { } ;""
kdevelop(31278)/kdevelop (cpp support) DumpChain::visit: "| " \ SimpleDeclaration [( 1 ) (0, 0) ] ""class Foo { } ;""
kdevelop(31278)/kdevelop (cpp support) DumpChain::visit: "| | " \ ClassSpecifier [( 1 ) (0, 0) ] ""class Foo { }""
kdevelop(31278)/kdevelop (cpp support) DumpChain::visit: "| | | " \ Name [( 2 ) (0, 6) ] ""Foo""
kdevelop(31278)/kdevelop (cpp support) DumpChain::visit: "| | | | " \ UnqualifiedName [( 2 ) (0, 6) ] ""Foo""
kdevelop(31278)/kdevelop (cpp support) DumpChain::visit: "| | | | " / UnqualifiedName [( 3 )  (1, 0) ]
kdevelop(31278)/kdevelop (cpp support) DumpChain::visit: "| | | " / Name [( 3 )  (1, 0) ]
kdevelop(31278)/kdevelop (cpp support) DumpChain::visit: "| | " / ClassSpecifier [( 5 )  (2, 1) ]
kdevelop(31278)/kdevelop (cpp support) DumpChain::visit: "| " / SimpleDeclaration [( 6 )  (3, 0) ]
kdevelop(31278)/kdevelop (cpp support) DumpChain::visit: "" / TranslationUnit [( 6 )  (3, 0) ]
kdevelop(31278)/kdevelop (cpp support) DumpChain::dump: "" New Context  0x83068c0 " "" " [ "" ] [ (0, 0)  ->  (0, 0) ]   top-context
kdevelop(31278)/kdevelop (cpp support) DumpChain::dump: "  " ==import==> Context  0x864bcc8 " "" " [ "" ] [ (0, 0)  ->  (3, 0) ]   top-context

Thats from a simple "class Foo {};" apparently. What I don't quite
understand here is that there's no Declaration dumped by DumpChain,
while apparently it got created:

kdevelop(31278)/kdevelop (cpp support) ContextBuilder::buildContexts: built top-level context with 1 declarations and 0 included files

Andreas

PS: Thanks for answering all these noob questions, I owe you a beer or
two.

-- 
Beware of low-flying butterflies.




More information about the KDevelop-devel mailing list