| 67 | } |
| 68 | |
| 69 | uint buildIdentifierForType(const AbstractType::Ptr& type, IndexedTypeIdentifier& id, uint pointerLevel, TopDUContext* top) |
| 70 | { |
| 71 | if (!type) { |
| 72 | return pointerLevel; |
| 73 | } |
| 74 | if (auto refType = type.dynamicCast<ReferenceType>()) { |
| 75 | id.setIsReference(true); |
| 76 | if (refType->modifiers() & AbstractType::ConstModifier) { |
| 77 | id.setIsConstant(true); |
| 78 | } |
| 79 | |
| 80 | return buildIdentifierForType(refType->baseType(), id, pointerLevel, top); |
| 81 | } |
| 82 | |
| 83 | if (auto pointerType = type.dynamicCast<PointerType>()) { |
| 84 | ++pointerLevel; |
| 85 | uint maxPointerLevel = buildIdentifierForType(pointerType->baseType(), id, pointerLevel, top); |
| 86 | if (type->modifiers() & AbstractType::ConstModifier) { |
| 87 | id.setIsConstPointer(maxPointerLevel - pointerLevel, true); |
| 88 | } |
| 89 | if (static_cast<uint>(id.pointerDepth()) < pointerLevel) { |
| 90 | id.setPointerDepth(pointerLevel); |
| 91 | } |
| 92 | |
| 93 | return maxPointerLevel; |
| 94 | } |
| 95 | |
| 96 | AbstractType::Ptr useTypeText = type; |
| 97 | if (type->modifiers() & AbstractType::ConstModifier) { |
| 98 | //Remove the 'const' modifier, as it will be added to the type-identifier below |
| 99 | useTypeText = IndexedType(type).abstractType(); |
| 100 | useTypeText->setModifiers(useTypeText->modifiers() & (~AbstractType::ConstModifier)); |
| 101 | } |
| 102 | id.setIdentifier(QualifiedIdentifier(useTypeText->toString(), true)); |
| 103 | |
| 104 | if (type->modifiers() & AbstractType::ConstModifier) { |
| 105 | id.setIsConstant(true); |
| 106 | } |
| 107 | if (type->modifiers() & AbstractType::VolatileModifier) { |
| 108 | id.setIsVolatile(true); |
| 109 | } |
| 110 | return pointerLevel; |
| 111 | } |
| 112 | |
| 113 | IndexedTypeIdentifier identifierForType(const AbstractType::Ptr& type, TopDUContext* top) |
| 114 | { |
no test coverage detected