Add flag to declarations marking them as auto/deduced?

Sven Brauch mail at svenbrauch.de
Tue Aug 14 12:49:46 BST 2018


Hey,

On Tuesday, 14 August 2018 13:39:43 CEST Michal Srb wrote:
> 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 first reaction was "hm, that doesn't make sense for a lot of languages" but 
thinking about it, you can probably find a use for the flag in a lot of them. 
Even in Python, people increasinly move towards explicit type hints in some 
contexts, and you could set the flag according to that.

> So my questions are:
> * Is it ok to add such information to the Declaration?

I would say yes. The bitfield currently has 8 items unfortunately, so it will 
increase the size of each Declaration by 1 byte, but ok.
Don't forget to increase KDEV_ITEMREPOSITORY_INCREMENT in CMakeLists.txt!

> * How should it be called? There is already a flag called
> `isAutoDeclaration`/`setAutoDeclaration`, which does not seem to be
> used at all.

No, that is used for something different, but not by C++ (it's used by 
Python). It marks declarations which were implicitly created by a member 
access.
Maybe something like "isExplicitlyTyped" or "isImplicitlyTyped" or 
"isTypeAutoDeduced" or so?

Best,
Sven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20180814/545f3692/attachment.sig>


More information about the KDevelop-devel mailing list