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

Method HandleCompoundStmt

CodeGenerator.cpp:2503–2528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2501//-----------------------------------------------------------------------------
2502
2503void CodeGenerator::HandleCompoundStmt(const CompoundStmt* stmt)
2504{
2505 for(const auto* item : stmt->body()) {
2506 InsertArg(item);
2507
2508 // Skip inserting a semicolon, if this is a LambdaExpr and out stack is empty. This addresses a special case
2509 // #344.
2510 const bool skipSemiForLambda{mLambdaStack.empty() and isa<LambdaExpr>(item)};
2511
2512 if(IsStmtRequiringSemi<IfStmt,
2513 NullStmt,
2514 ForStmt,
2515 DeclStmt,
2516 WhileStmt,
2517 DoStmt,
2518 CXXForRangeStmt,
2519 SwitchStmt,
2520 CXXTryStmt,
2521 CppInsightsCommentStmt>(item) and
2522 InsertSemi() and not skipSemiForLambda and not mSkipSemi) {
2523 mOutputFormatHelper.AppendSemiNewLine();
2524 }
2525
2526 mSkipSemi = false;
2527 }
2528}
2529//-----------------------------------------------------------------------------
2530
2531void CodeGenerator::InsertIfOrSwitchInitVariables(same_as_any_of<const IfStmt, const SwitchStmt> auto* stmt)

Callers

nothing calls this directly

Calls 2

AppendSemiNewLineMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected