Discussion:
[Qt-creator] Find Usages of auto variable
Jochen Becher
2018-09-30 18:12:08 UTC
Permalink
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?

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

Regards,

Jochen
Nikolai Kosjar
2018-10-01 08:14:49 UTC
Permalink
Post by Jochen Becher
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
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...
Post by Jochen Becher
Other features of ClangCodeModel like error messages in editor text
(tested with "use of undeclared identifier") work.
Regards,
Jochen
Loading...