File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,17 @@ void findTypeLocForBlockDecl(const clang::TypeSourceInfo *TSInfo,
6363
6464} // namespace
6565
66+ static std::string OriginalNameTypedef (const clang::QualType &qt,
67+ const clang::PrintingPolicy &policy) {
68+ if (const auto *tt = llvm::dyn_cast<clang::TypedefType>(qt.getTypePtrOrNull ())) {
69+ const auto *td = tt->getDecl ();
70+ if (!td->getName ().empty ())
71+ return td->getName ().str ();
72+ }
73+ return qt.getAsString (policy);
74+ }
75+
76+
6677DeclarationFragments &
6778DeclarationFragments::appendUnduplicatedTextCharacter (char Character) {
6879 if (!Fragments.empty ()) {
@@ -452,7 +463,8 @@ DeclarationFragments DeclarationFragmentsBuilder::getFragmentsForType(
452463 // Default fragment builder for other kinds of types (BuiltinType etc.)
453464 SmallString<128 > USR;
454465 clang::index::generateUSRForType (Base, Context, USR);
455- Fragments.append (Base.getAsString (),
466+ std::string typestr = OriginalNameTypedef (Base, Context.getPrintingPolicy ());
467+ Fragments.append (typestr,
456468 DeclarationFragments::FragmentKind::TypeIdentifier, USR);
457469
458470 return Fragments;
You can’t perform that action at this time.
0 commit comments