@@ -596,19 +596,24 @@ std::string GetName(TCppType_t klass) {
596596 return " <unnamed>" ;
597597}
598598
599- std::string GetCompleteName (TCppType_t klass) {
599+ static std::string GetCompleteNameImpl (TCppType_t klass, bool qualified ) {
600600 auto & C = getSema ().getASTContext ();
601601 auto * D = (Decl*)klass;
602602
603- PrintingPolicy Policy = C.getPrintingPolicy ();
604- Policy.SuppressUnwrittenScope = true ;
605- Policy.SuppressScope = true ;
606- Policy.AnonymousTagLocations = false ;
607- Policy.SuppressTemplateArgsInCXXConstructors = false ;
608- Policy.SuppressDefaultTemplateArgs = false ;
609- Policy.AlwaysIncludeTypeForTemplateArgument = true ;
610-
611603 if (auto * ND = llvm::dyn_cast_or_null<NamedDecl>(D)) {
604+ PrintingPolicy Policy = C.getPrintingPolicy ();
605+ Policy.SuppressUnwrittenScope = true ;
606+ if (qualified) {
607+ Policy.FullyQualifiedName = true ;
608+ Policy.SuppressElaboration = true ;
609+ } else {
610+ Policy.SuppressScope = true ;
611+ Policy.AnonymousTagLocations = false ;
612+ Policy.SuppressTemplateArgsInCXXConstructors = false ;
613+ Policy.SuppressDefaultTemplateArgs = false ;
614+ Policy.AlwaysIncludeTypeForTemplateArgument = true ;
615+ }
616+
612617 if (auto * TD = llvm::dyn_cast<TagDecl>(ND)) {
613618 std::string type_name;
614619 QualType QT = C.getTagDeclType (TD);
@@ -618,12 +623,12 @@ std::string GetCompleteName(TCppType_t klass) {
618623 if (auto * FD = llvm::dyn_cast<FunctionDecl>(ND)) {
619624 std::string func_name;
620625 llvm::raw_string_ostream name_stream (func_name);
621- FD->getNameForDiagnostic (name_stream, Policy, false );
626+ FD->getNameForDiagnostic (name_stream, Policy, qualified );
622627 name_stream.flush ();
623628 return func_name;
624629 }
625630
626- return ND->getNameAsString ();
631+ return qualified ? ND-> getQualifiedNameAsString () : ND->getNameAsString ();
627632 }
628633
629634 if (llvm::isa_and_nonnull<TranslationUnitDecl>(D)) {
@@ -633,6 +638,10 @@ std::string GetCompleteName(TCppType_t klass) {
633638 return " <unnamed>" ;
634639}
635640
641+ std::string GetCompleteName (TCppType_t klass) {
642+ return GetCompleteNameImpl (klass, /* qualified=*/ false );
643+ }
644+
636645std::string GetQualifiedName (TCppType_t klass) {
637646 auto * D = (Decl*)klass;
638647 if (auto * ND = llvm::dyn_cast_or_null<NamedDecl>(D)) {
@@ -646,32 +655,8 @@ std::string GetQualifiedName(TCppType_t klass) {
646655 return " <unnamed>" ;
647656}
648657
649- // FIXME: Figure out how to merge with GetCompleteName.
650658std::string GetQualifiedCompleteName (TCppType_t klass) {
651- auto & C = getSema ().getASTContext ();
652- auto * D = (Decl*)klass;
653-
654- if (auto * ND = llvm::dyn_cast_or_null<NamedDecl>(D)) {
655- if (auto * TD = llvm::dyn_cast<TagDecl>(ND)) {
656- std::string type_name;
657- QualType QT = C.getTagDeclType (TD);
658- PrintingPolicy PP = C.getPrintingPolicy ();
659- PP.FullyQualifiedName = true ;
660- PP.SuppressUnwrittenScope = true ;
661- PP.SuppressElaboration = true ;
662- QT.getAsStringInternal (type_name, PP);
663-
664- return type_name;
665- }
666-
667- return ND->getQualifiedNameAsString ();
668- }
669-
670- if (llvm::isa_and_nonnull<TranslationUnitDecl>(D)) {
671- return " " ;
672- }
673-
674- return " <unnamed>" ;
659+ return GetCompleteNameImpl (klass, /* qualified=*/ true );
675660}
676661
677662std::string GetDoxygenComment (TCppScope_t scope, bool strip_comment_markers) {
0 commit comments