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

Function shortenedTypeIdentifier

plugins/clang/codegen/codegenhelper.cpp:342–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340}
341
342IndexedTypeIdentifier shortenedTypeIdentifier(const AbstractType::Ptr& type_, DUContext* ctx, int desiredLength,
343 const QualifiedIdentifier& stripPrefix)
344{
345 bool isReference = false;
346 bool isRValue = false;
347
348 auto type = type_;
349 if (auto refType = type.dynamicCast<ReferenceType>()) {
350 isReference = true;
351 type = refType->baseType();
352 isRValue = refType->isRValue();
353 }
354
355 type = shortenTypeForViewing(type);
356
357 if (ctx) {
358 type = stripType(type, ctx);
359 }
360 if (!type) {
361 return IndexedTypeIdentifier();
362 }
363
364 IndexedTypeIdentifier identifier = identifierForType(type, ctx ? ctx->topContext() : nullptr);
365
366 identifier = stripPrefixIdentifiers(identifier, stripPrefix);
367
368 if (isReference) {
369 identifier.setIsReference(true);
370 }
371 if (isRValue) {
372 identifier.setIsRValue(true);
373 }
374
375 int removeTemplateParametersFrom = 10;
376
377 while (identifier.toString().length() > desiredLength * 3 && removeTemplateParametersFrom >= 0) {
378 --removeTemplateParametersFrom;
379 identifier = removeTemplateParameters(identifier, removeTemplateParametersFrom);
380 }
381 return identifier;
382}
383
384QString makeSignatureString(const KDevelop::Declaration* functionDecl, const Signature& signature, const bool editingDefinition)
385{

Callers 1

shortenedTypeStringFunction · 0.85

Calls 13

shortenTypeForViewingFunction · 0.85
stripTypeFunction · 0.85
identifierForTypeFunction · 0.85
stripPrefixIdentifiersFunction · 0.85
removeTemplateParametersFunction · 0.85
setIsReferenceMethod · 0.80
baseTypeMethod · 0.45
isRValueMethod · 0.45
topContextMethod · 0.45
setIsRValueMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected