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

Method exchange

plugins/clang/codegen/codegenhelper.cpp:167–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165 : public TypeExchanger
166 {
167 AbstractType::Ptr exchange(const AbstractType::Ptr& type) override {
168 if (!type) {
169 return type;
170 }
171
172 AbstractType::Ptr newType(type->clone());
173
174 if (auto alias = type.dynamicCast<TypeAliasType>()) {
175 //If the aliased type has less involved template arguments, prefer it
176 AbstractType::Ptr shortenedTarget = exchange(alias->type());
177 if (shortenedTarget && shortenedTarget->toString().count(QLatin1Char('<')) < alias->toString().count(QLatin1Char('<'))
178 && reservedIdentifierCount(shortenedTarget->toString()) <= reservedIdentifierCount(alias->toString()))
179 {
180 shortenedTarget->setModifiers(shortenedTarget->modifiers() | alias->modifiers());
181 return shortenedTarget;
182 }
183 }
184
185 newType->exchangeTypes(this);
186
187 return newType;
188 }
189 };
190
191 ShortenAliasExchanger exchanger;

Callers 2

shortenTypeForViewingFunction · 0.45
stripTypeFunction · 0.45

Calls 8

reservedIdentifierCountFunction · 0.85
setModifiersMethod · 0.80
modifiersMethod · 0.80
cloneMethod · 0.45
typeMethod · 0.45
countMethod · 0.45
toStringMethod · 0.45
exchangeTypesMethod · 0.45

Tested by

no test coverage detected