[Qt-creator] Find Usages of auto variable

Nikolai Kosjar nikolai.kosjar at qt.io
Mon Oct 1 10:14:49 CEST 2018


On 09/30/2018 08:12 PM, Jochen Becher wrote:
> I am not sure if this is related to the new version 4.7.1 I just
> installed but "Find Usages" does not work (anymore?) with auto
> variables:
> 
> This is code from modelinglib:
> 
> void DFlatAssignmentVisitor::visitDClass(const DClass *klass)
> {
>      visitDObject(klass);
>      auto target = dynamic_cast<DClass *>(m_target);
>      QMT_ASSERT(target, return);
>      target->setUmlNamespace(klass->umlNamespace());
>      target->setTemplateParameters(klass->templateParameters());
>      target->setTemplateDisplay(klass->templateDisplay());
>      target->setMembers(klass->members());
>      target->setShowAllMembers(klass->showAllMembers());
>      target->setVisibleMembers(klass->visibleMembers());
> }
> 
> 
> Selecting "Find Usages" on "setUmlNamespace" (or any other method name)
> does nothing. If I select "Find Usages" on the declaration of method
> "setUmlNamespace" in DClass this usage and all other usages where an
> auto variable is involved is not found.
> 
> If I replace "auto" with "DClass *" it works again (for this usage of
> "setUmlNamespace"; not for the others where auto is still used).
> 
> Looks like "auto" is not supported with ClangCodeModel 4.7.1. Wasn't it
> before?

"Find Usages" isn't ported to the ClangCodeModel, it still relies on the 
built-in code model. The indexing based on clang is in the works...

> Other features of ClangCodeModel like error messages in editor text
> (tested with "use of undeclared identifier") work.
> 
> Regards,
> 
> Jochen



More information about the Qt-creator mailing list