Skip to content

Commit 84b99b4

Browse files
authored
[NFC][CodingStandard] Extend if-else brace example with else-if (#112193)
Extend example to document that single statement `else if` needs a brace as well if the associated `if` needs a brace.
1 parent a8b5115 commit 84b99b4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/docs/CodingStandards.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,10 +1713,13 @@ would help to avoid running into a "dangling else" situation.
17131713
handleOtherDecl(D);
17141714
}
17151715

1716-
// Use braces for the `else` block to keep it uniform with the `if` block.
1716+
// Use braces for the `else if` and `else` block to keep it uniform with the
1717+
// `if` block.
17171718
if (isa<FunctionDecl>(D)) {
17181719
verifyFunctionDecl(D);
17191720
handleFunctionDecl(D);
1721+
} else if (isa<GlobalVarDecl>(D)) {
1722+
handleGlobalVarDecl(D);
17201723
} else {
17211724
handleOtherDecl(D);
17221725
}

0 commit comments

Comments
 (0)