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

Function targetType

kdevplatform/language/duchain/types/typeutils.cpp:40–67  ·  view source on GitHub ↗

@todo remove constant and topContext

Source from the content-addressed store, hash-verified

38
39///@todo remove constant and topContext
40AbstractType::Ptr targetType(const AbstractType::Ptr& _base, const TopDUContext* /*topContext*/, bool* /*constant*/)
41{
42 auto base = _base;
43
44 auto ref = base.dynamicCast<ReferenceType>();
45 auto pnt = base.dynamicCast<PointerType>();
46 auto alias = base.dynamicCast<TypeAliasType>();
47
48 while (ref || pnt || alias) {
49 uint hadModifiers = base->modifiers();
50
51 if (ref) {
52 base = ref->baseType();
53 } else if (pnt) {
54 base = pnt->baseType();
55 } else {
56 base = alias->type();
57 }
58 if ((alias || ref) && hadModifiers && base)
59 base->setModifiers(base->modifiers() | hadModifiers);
60
61 ref = base.dynamicCast<ReferenceType>();
62 pnt = base.dynamicCast<PointerType>();
63 alias = base.dynamicCast<TypeAliasType>();
64 }
65
66 return base;
67}
68
69AbstractType::Ptr targetTypeKeepAliases(const AbstractType::Ptr& _base, const TopDUContext* /*topContext*/,
70 bool* /*constant*/)

Callers 2

DeclarationTestFunction · 0.85
typeForDeclarationMethod · 0.85

Calls 4

modifiersMethod · 0.80
setModifiersMethod · 0.80
baseTypeMethod · 0.45
typeMethod · 0.45

Tested by 1

DeclarationTestFunction · 0.68