How does C++ support create class declarations?

David Nolden zwabel at
Mon Feb 18 21:30:20 UTC 2008

On Monday 18 February 2008 21:56:12 Andreas Pakulat wrote:
> 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

This looks that strange because of simplified environment matching. You 
shouldn't care about that thing for python. 

Just to summarize what it does: When a file is parsed, it is represented by 2 
top-contexts: One that represents the file exactly in an ideal way in the 
eyes of the preprocessor(including problems etc.), and one that contains the 
actual duchain content. The preprocessor-context has the flag 
TopDUContext::ProxyContext set, and the first file imported into the 
proxy-context is the content-context. That's why you get just an empty 
context with one import(the proxy context). The "simplified" 
environment-matching is there to save a lot of memory, because in many cases 
files that actually have the same content are preprocessed differently 
because of included files. The name "simplified" matching is a little 
misleading though, because it's in fact very complicated. ;) For more 
information, see environmentmanager.h.

If you want to experiment, you should better do it in test_duchain.cpp, 
because simplified matching isn't used there, or you can turn it off in the 
initialization of CppLanguageSupport.

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

No problem, Python is my scripting-language, so I am very interested in a 
usable python support some time in future  :)

Greetings, David

More information about the KDevelop-devel mailing list