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

Method InsertCXXMethodDecl

CodeGenerator.cpp:3296–3339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3294//-----------------------------------------------------------------------------
3295
3296void CodeGenerator::InsertCXXMethodDecl(const CXXMethodDecl* stmt, SkipBody skipBody)
3297{
3298 OutputFormatHelper initOutputFormatHelper{};
3299 initOutputFormatHelper.SetIndent(mOutputFormatHelper, OutputFormatHelper::SkipIndenting::Yes);
3300
3301 const auto posBeforeFunc = mOutputFormatHelper.CurrentPos();
3302
3303 InsertCXXMethodHeader(stmt, initOutputFormatHelper);
3304
3305 if(not stmt->isUserProvided() or stmt->isExplicitlyDefaulted()) {
3306 InsertTemplateGuardEnd(stmt);
3307 return;
3308 }
3309
3310 mOutputFormatHelper.Append(initOutputFormatHelper);
3311
3312 if(isa<CXXConversionDecl>(stmt)) {
3313 if(stmt->getParent()->isLambda() and not stmt->doesThisDeclarationHaveABody()) {
3314 mOutputFormatHelper.AppendNewLine();
3315 WrapInCurlys([&]() {
3316 mOutputFormatHelper.AppendNewLine();
3317 mOutputFormatHelper.Append(" "sv, kwReturn, " "sv);
3318 if(const auto* invoker = stmt->getParent()->getLambdaStaticInvoker()) {
3319 mOutputFormatHelper.AppendSemiNewLine(invoker->getName());
3320 } else {
3321 mOutputFormatHelper.AppendSemiNewLine(kwOperator, "()"sv);
3322 }
3323 });
3324 }
3325 }
3326
3327 if((SkipBody::No == skipBody) and stmt->doesThisDeclarationHaveABody() and not stmt->isLambdaStaticInvoker()) {
3328 InsertMethodBody(stmt, posBeforeFunc);
3329
3330 } else if(not InsertLambdaStaticInvoker(stmt) or (SkipBody::Yes == skipBody)) {
3331 mOutputFormatHelper.AppendSemiNewLine();
3332 }
3333
3334 InsertTemplateGuardEnd(stmt);
3335
3336 if(SkipBody::No == skipBody) {
3337 mOutputFormatHelper.AppendNewLine();
3338 }
3339}
3340//-----------------------------------------------------------------------------
3341
3342void CodeGenerator::InsertArg(const CXXMethodDecl* stmt)

Callers

nothing calls this directly

Calls 6

SetIndentMethod · 0.80
CurrentPosMethod · 0.80
AppendMethod · 0.80
AppendNewLineMethod · 0.80
AppendSemiNewLineMethod · 0.80
getNameMethod · 0.80

Tested by

no test coverage detected