DUChain::chainsForDocument
David Nolden
zwabel at googlemail.com
Fri Aug 15 14:02:45 UTC 2008
Am Freitag, 15. August 2008 15:39:43 schrieb Esben Mose Hansen:
> Hi,
>
> In my small test plugin, if I do
>
> IDocument* doc = core()->documentController()->activeDocument();
> DUChainReadLocker lock(DUChain::lock());
> TopDUContext* topDuContext = DUChain::self()->chainsForDocument(
> doc->url() )[1];
>
> At least one file behaves as it should, with lots of child context.
> However, if I use the more correct(?)
>
> TopDUContext* topDuContext = KDevelop::DUChain::self()->chainForDocument(
> doc->url() );
>
> I get a topDuContext* that has no child ducontexts at all (though the range
> seems correct). What is the differences between these ducontexts, and how
> do I fetch the correct one?
The problem is that in C++, the files are currently always split into 2 parts:
One proxy-context, and one content-context. Each proxy-context has a
content-context attached, and represents a logical "preprocessed file"
including all the includes, while the content-context only represents the
declarations/top-contexts within the physical file.
If you want to get a useful top-context, you should use standardContextForUrl,
from kdevplatform/language/duchain/duchainutils.h.
Greetings, David
More information about the KDevelop-devel
mailing list