Skip to content

Commit

Permalink
[NFC][CodingStandard] Extend if-else brace example with else-if (llvm…
Browse files Browse the repository at this point in the history
…#112193)

Extend example to document that single statement `else if` needs a brace
as well if the associated `if` needs a brace.
  • Loading branch information
jurahul authored Oct 14, 2024
1 parent a8b5115 commit 84b99b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion llvm/docs/CodingStandards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1713,10 +1713,13 @@ would help to avoid running into a "dangling else" situation.
handleOtherDecl(D);
}

// Use braces for the `else` block to keep it uniform with the `if` block.
// Use braces for the `else if` and `else` block to keep it uniform with the
// `if` block.
if (isa<FunctionDecl>(D)) {
verifyFunctionDecl(D);
handleFunctionDecl(D);
} else if (isa<GlobalVarDecl>(D)) {
handleGlobalVarDecl(D);
} else {
handleOtherDecl(D);
}
Expand Down

0 comments on commit 84b99b4

Please sign in to comment.