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

Method FillConstantArray

CodeGenerator.cpp:1936–1952  ·  view source on GitHub ↗

Fill the values of a constant array. This is either called by \c InitListExpr (which may contain an offset, as the user already provided certain values) or by \c GetValueOfValueInit.

Source from the content-addressed store, hash-verified

1934/// This is either called by \c InitListExpr (which may contain an offset, as the user already provided certain
1935/// values) or by \c GetValueOfValueInit.
1936std::string
1937CodeGenerator::FillConstantArray(const ConstantArrayType* ct, const std::string& value, const uint64_t startAt)
1938{
1939 OutputFormatHelper ret{};
1940
1941 if(ct) {
1942 const auto size{std::clamp(GetSize(ct), uint64_t{0}, MAX_FILL_VALUES_FOR_ARRAYS)};
1943
1944 OnceFalse needsComma{uint64_t{0} != startAt};
1945 for_each(startAt, size, [&](auto) {
1946 ret.AppendComma(needsComma);
1947 ret.Append(value);
1948 });
1949 }
1950
1951 return ret.GetString();
1952}
1953//-----------------------------------------------------------------------------
1954
1955void CodeGenerator::InsertArg(const InitListExpr* stmt)

Callers

nothing calls this directly

Calls 4

GetSizeFunction · 0.85
for_eachFunction · 0.85
AppendCommaMethod · 0.80
AppendMethod · 0.80

Tested by

no test coverage detected