Inconsistent behaviour of AliasDeclarations + DUContext::localDeclarations()?
Sven Brauch
svenbrauch at googlemail.com
Sat Apr 14 22:34:19 UTC 2012
Anyone? I really need your opinions on this. :)
I can also submit a patch which changes the behaviour to what I
suggested, if you find that easier to discuss.
Greetings
2012/4/11, Sven Brauch <svenbrauch at googlemail.com>:
> Hi there,
>
> it's me again with another problem regarding AliasDeclarations:
> The DUContext::localDeclarations() function does resolve all alias
> declarations it finds and returns their aliasedDeclaration()s. All
> other similar functions, like findDeclarations(), allDeclarations()
> etc. do *not* do this, they return the AliasDeclaration instance
> itself instead. See ducontext.cpp:636.
>
> I'm wondering if this behaviour is intended or if any code relies on
> it (C++ doesn't seem to break if I change it). Reading the code, it
> might very well be unintentional.
>
> Does anyone know about this? My usecase would require
> localDeclarations() to not dismiss the information whether the found
> object is an alias declaration or not.
>
> Then, another question about the same function, just a few lines
> below: The code checks whether the range of the aliased declaration
> begins before the current position, with a comment saying this is
> specific to C++. I'd require checking whether the top-context of the
> declaration matches the current top context (in which case it would be
> valid too), in case a class or function from another top context is
> aliased (in that case, the range check makes simply no sense at all
> btw, because a range in file A is compared to a range in file B). I'd
> like to change this, too -- or is this intended?
>
> Greetings,
> Sven
>
More information about the KDevelop-devel
mailing list