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

Function GetSpecialMemberName

CfrontCodeGenerator.cpp:138–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136//-----------------------------------------------------------------------------
137
138static std::string GetSpecialMemberName(const ValueDecl* vd, QualType type)
139{
140 if(const auto* md = dyn_cast_or_null<CXXMethodDecl>(vd)) {
141 // GetName below would return a[4] for example. To avoid the array part we go for the underlying type.
142 if(const auto* ar = dyn_cast_or_null<ArrayType>(type)) {
143 type = ar->getElementType();
144 }
145
146 auto rdName = GetName(type);
147
148 if(const auto* ctor = dyn_cast_or_null<CXXConstructorDecl>(md)) {
149 if(ctor->isCopyConstructor()) {
150 return StrCat("CopyConstructor_"sv, rdName);
151 } else if(ctor->isMoveConstructor()) {
152 return StrCat("MoveConstructor_"sv, rdName);
153 }
154
155 return StrCat("Constructor_"sv, rdName);
156
157 } else if(isa<CXXDestructorDecl>(md)) {
158 return StrCat("Destructor_"sv, rdName);
159 }
160 }
161
162 return GetName(*vd);
163}
164//-----------------------------------------------------------------------------
165
166std::string GetSpecialMemberName(const ValueDecl* vd)

Callers 5

CallVecDeleteOrDtorFunction · 0.85
CallVecNewOrCtorFunction · 0.85
InsertCXXMethodDeclMethod · 0.85
InsertArgMethod · 0.85

Calls 3

GetNameFunction · 0.85
StrCatFunction · 0.85
GetRecordDeclTypeFunction · 0.85

Tested by

no test coverage detected