Inconsistent behaviour of AliasDeclarations + DUContext::localDeclarations()?

Sven Brauch svenbrauch at googlemail.com
Wed Apr 11 15:38:15 UTC 2012


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