From 84b99b4b1ee19b81d8a1ac780f7aa307ce3b84da Mon Sep 17 00:00:00 2001 From: Rahul Joshi Date: Mon, 14 Oct 2024 07:20:39 -0700 Subject: [PATCH] [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. --- llvm/docs/CodingStandards.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst index 87bbb3d127ad5..6e90efe0f1119 100644 --- a/llvm/docs/CodingStandards.rst +++ b/llvm/docs/CodingStandards.rst @@ -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(D)) { verifyFunctionDecl(D); handleFunctionDecl(D); + } else if (isa(D)) { + handleGlobalVarDecl(D); } else { handleOtherDecl(D); }