Skip to content

Remove useless [Indexed]QualifiedIdentifier conversions

Igor Kushnir requested to merge work/optimize-declaration-id-declaration-s into master

DeclarationId::declaration[s]() construct a QualifiedIdentifier from an IndexedQualifiedIdentifier and pass it to one of two functions. Each of the two functions takes a const IndexedQualifiedIdentifier& id parameter and assigns the id argument to a local variable before doing anything else. Eliminate the redundant explicit conversion from IndexedQualifiedIdentifier to QualifiedIdentifier and implicit conversion back.

The only way this optimization can break something is if the local variable QualifiedIdentifier id keeps the IndexedQualifiedIdentifier valid somehow. But I do not think this is the case.

For some reason, KDevelop segfaulted during the implicit conversion back from QualifiedIdentifier to IndexedQualifiedIdentifier in DeclarationId::declaration() as described in Bug 482001. Hopefully this optimization will eliminate the crash, or at least move elsewhere, facilitate understanding and fixing it.

BUG: 482001
FIXED-IN: 5.14

Merge request reports