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

Method AppendParameterList

OutputFormatHelper.cpp:24–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22//-----------------------------------------------------------------------------
23
24void OutputFormatHelper::AppendParameterList(const ArrayRef<ParmVarDecl*> parameters,
25 const NameOnly nameOnly,
26 const GenMissingParamName genMissingParamName)
27{
28 int count{};
29
30 ForEachArg(parameters, [&](const auto& p) {
31 auto name{GetName(*p)};
32
33 // A special case for CXXInheritedCtor. A user can omit the parameters name, but wihtout a name the call to the
34 // base constructor may look like calling the default constructor. In such a case we create a name.
35 if((GenMissingParamName::Yes == genMissingParamName) && (0 == name.length())) {
36 name = BuildInternalVarName(StrCat("param", count));
37 ++count;
38 }
39
40 // Get the attributes and insert them, if there are any
41 CodeGeneratorVariant codeGenerator{*this};
42 codeGenerator->InsertAttributes(p->attrs());
43
44 if(const auto type{GetType(p->getType())}; NameOnly::No == nameOnly) {
45
46 Append(GetTypeNameAsParameter(type, name));
47 } else {
48 Append(name);
49
50 if(isa<PackExpansionType>(type)) {
51 Append(kwElipsis);
52 }
53 }
54 });
55}
56//-----------------------------------------------------------------------------
57
58void OutputFormatHelper::CloseScope(const NoNewLineBefore newLineBefore)

Callers 3

InsertArgMethod · 0.80

Calls 6

GetNameFunction · 0.85
BuildInternalVarNameFunction · 0.85
StrCatFunction · 0.85
GetTypeFunction · 0.85
GetTypeNameAsParameterFunction · 0.85
InsertAttributesMethod · 0.80

Tested by

no test coverage detected