MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / GetName

Function GetName

InsightsHelpers.cpp:894–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892//-----------------------------------------------------------------------------
893
894static std::string GetName(QualType t,
895 const Unqualified unqualified = Unqualified::No,
896 const InsightsSuppressScope supressScope = InsightsSuppressScope::No)
897{
898 const CppInsightsPrintingPolicy printingPolicy{unqualified,
899 supressScope,
900 (isa<AutoType>(t.getTypePtrOrNull())) ? InsightsCanonicalTypes::Yes
901 : InsightsCanonicalTypes::No};
902
903 if(SimpleTypePrinter st{t, printingPolicy}; st.GetTypeString()) {
904 return ScopeHandler::RemoveCurrentScope(st.GetString());
905 }
906
907 // To get the namespace handling right we need to look into the ElaboratedType in some cases.
908 // However, only do that, if the type it not a dependent type. A dependent type might cause type-parameter stuff.
909 if(const auto* et = t->getAs<ElaboratedType>();
910 et and (nullptr == et->getQualifier()) and (nullptr == et->getOwnedTagDecl()) and not et->isDependentType()) {
911 const auto quals = t.getLocalFastQualifiers();
912 t = et->getNamedType();
913 t.setLocalFastQualifiers(quals);
914 }
915
916 if(true == printingPolicy.CppInsightsUnqualified) {
917 t = t.getUnqualifiedType();
918 }
919
920 return ScopeHandler::RemoveCurrentScope(GetAsCPPStyleString(t, printingPolicy));
921}
922} // namespace details
923//-----------------------------------------------------------------------------
924

Callers 15

VisitDeclStmtMethod · 0.85
InsertCoroutineMethod · 0.85
CallConstructorFunction · 0.85
CallDestructorFunction · 0.85
InsertArgMethod · 0.85
InsertConstructorExprMethod · 0.85

Calls 15

GetAsCPPStyleStringFunction · 0.85
NeedsNamespaceFunction · 0.85
GetScopeFunction · 0.85
GetNamePlainFunction · 0.85
GetQualifiedNameFunction · 0.85
GetNestedNameFunction · 0.85
GetTemporaryNameFunction · 0.85
GetPlainNameFunction · 0.85

Tested by

no test coverage detected