MCPcopy Create free account
hub / github.com/KDE/kdevelop / adjustPriorityForType

Function adjustPriorityForType

plugins/clang/codecompletion/context.cpp:587–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585}
586
587int adjustPriorityForType(const AbstractType::Ptr& type, int completionPriority)
588{
589 const auto modifier = 4;
590 if (type) {
591 const auto whichType = type->whichType();
592 if (whichType == AbstractType::TypePointer || whichType == AbstractType::TypeReference) {
593 // Clang considers all pointers as similar, this is not what we want.
594 completionPriority += modifier;
595 } else if (whichType == AbstractType::TypeStructure) {
596 // Clang considers all classes as similar too...
597 completionPriority += modifier;
598 } else if (whichType == AbstractType::TypeDelayed) {
599 completionPriority += modifier;
600 } else if (whichType == AbstractType::TypeAlias) {
601 auto aliasedType = type.staticCast<TypeAliasType>();
602 return adjustPriorityForType(aliasedType->type(), completionPriority);
603 } else if (whichType == AbstractType::TypeFunction) {
604 auto functionType = type.staticCast<FunctionType>();
605 return adjustPriorityForType(functionType->returnType(), completionPriority);
606 }
607 } else {
608 completionPriority += modifier;
609 }
610
611 return completionPriority;
612}
613
614/// Adjusts priority for the @p decl
615int adjustPriorityForDeclaration(Declaration* decl, int completionPriority)

Callers 1

Calls 3

whichTypeMethod · 0.45
typeMethod · 0.45
returnTypeMethod · 0.45

Tested by

no test coverage detected