[llvm] 84b99b4 - [NFC][CodingStandard] Extend if-else brace example with else-if (#112193)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 07:20:43 PDT 2024


Author: Rahul Joshi
Date: 2024-10-14T07:20:39-07:00
New Revision: 84b99b4b1ee19b81d8a1ac780f7aa307ce3b84da

URL: https://github.com/llvm/llvm-project/commit/84b99b4b1ee19b81d8a1ac780f7aa307ce3b84da
DIFF: https://github.com/llvm/llvm-project/commit/84b99b4b1ee19b81d8a1ac780f7aa307ce3b84da.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/docs/CodingStandards.rst

Removed: 
    


################################################################################
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