[llvm] [NFC][CodingStandard] Extend if-else brace example with else-if (PR #112193)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 14 05:54:44 PDT 2024
https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/112193
Extend example to document that single statement `else if` needs a brace as well if the associated `if` needs a brace.
>From 5d60f7fbade974eb7d756faa9055bc33051e420b Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Mon, 14 Oct 2024 05:18:56 -0700
Subject: [PATCH] [NFC][CodingStandard] Extend if-else brace example with
else-if
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 87bbb3d127ad51..6e90efe0f11197 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<FunctionDecl>(D)) {
verifyFunctionDecl(D);
handleFunctionDecl(D);
+ } else if (isa<GlobalVarDecl>(D)) {
+ handleGlobalVarDecl(D);
} else {
handleOtherDecl(D);
}
More information about the llvm-commits
mailing list