Add flag to declarations marking them as auto/deduced?

Michal Srb michalsrb at
Tue Aug 14 12:39:43 BST 2018


Firstly thank you for helping me get accepted!

I would like to add a flag to declarations that marks it as
auto/deduced. In C++ it would be set for any variable declaration that
used the auto keyword. In Rust to any declaration that did not
explicitly specify the type. In scripting languages it would be
probably set to most/all declarations.

My use case is the kdev-sourceinfo [1] plugin, which can show the
actual deduced type in an inline note next to the declaration. But it
needs a way to recognize whether the type was written there or was
deduced. Right now it just looks at the text left from the declaration
looking for "auto " string, which is ugly.

So my questions are:
* Is it ok to add such information to the Declaration?
* How should it be called? There is already a flag called
`isAutoDeclaration`/`setAutoDeclaration`, which does not seem to be
used at all. It could be used for this, but its documentation sounds
like it is meant for something else. Perhaps new one could be added
called `isDeduced`/`setDeduced`?

Michal Srb


More information about the KDevelop-devel mailing list