[NFC][CodingStandard] Add additional example for if-else brace rule#111733
[NFC][CodingStandard] Add additional example for if-else brace rule#111733
Conversation
Add example to document that single statement `else` needs a brace if the associated `if` needs a brace.
erichkeane
left a comment
There was a problem hiding this comment.
I'm OK with this, but we need to see how the RFC goes before we can accept it.
|
I see this example as covering what the text already states:
The example sections is meant to illustrate the text, so LGTM here. |
Agreed. The example is meant as additional reinforcement as the first instinct might be to look at examples, and since this one is commonly violated, would help with an example. I'll let the thread sit for a week or 2 and if there are no concerns raised, we can commit this PR. |
jayfoad
left a comment
There was a problem hiding this comment.
Seems obviously fine to me for the reasons @joker-eph explained. I don't even think there's any need to wait a week or two.
rnk
left a comment
There was a problem hiding this comment.
This example seems consistent with the policy to me.
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/123/builds/7356 Here is the relevant piece of the build log for the reference |
…ent-indentonly * llvm-trunk/main: (6379 commits) [gn build] Port 1c94388 [RISCV] Introduce VLOptimizer pass (llvm#108640) [mlir][vector] Add more tests for ConvertVectorToLLVM (7/n) (llvm#111895) [libc++] Add output groups to run-buildbot (llvm#111739) [libc++abi] Remove unused LIBCXXABI_LIBCXX_INCLUDES CMake option (llvm#111824) [clang] Ignore inline namespace for `hasName` (llvm#109147) [AArch64] Disable consecutive store merging when Neon is unavailable (llvm#111519) [lldb] Fix finding make tool for tests (llvm#111980) Turn `-Wdeprecated-literal-operator` on by default (llvm#111027) [AMDGPU] Rewrite RegSeqNames using !foreach. NFC. (llvm#111994) Revert "Reland: [clang] Finish implementation of P0522 (llvm#111711)" Revert "[clang] CWG2398: improve overload resolution backwards compat (llvm#107350)" Revert "[clang] Implement TTP P0522 pack matching for deduced function template calls. (llvm#111457)" [Clang] Replace Intrinsic::getDeclaration with getOrInsertDeclaration (llvm#111990) Revert "[NVPTX] Prefer prmt.b32 over bfi.b32 (llvm#110766)" [RISCV] Add DAG combine to turn (sub (shl X, 8-Y), (shr X, Y)) into orc.b (llvm#111828) [libc] Fix compilation of new trig functions (llvm#111987) [NFC] Rename `Intrinsic::getDeclaration` to `getOrInsertDeclaration` (llvm#111752) [NFC][CodingStandard] Add additional example for if-else brace rule (llvm#111733) CodeGen: Remove redundant REQUIRES registered-target from tests (llvm#111982) ...
| if (isa<FunctionDecl>(D)) { | ||
| verifyFunctionDecl(D); | ||
| handleFunctionDecl(D); | ||
| } else { |
There was a problem hiding this comment.
I would add an else if single-statement block too.
There was a problem hiding this comment.
Sounds good, I'll amend the example to include an else if and an else.
…lvm#111733) Add example to document that single statement `else` needs a brace if the associated `if` needs a brace.
Add example to document that single statement
elseneeds a brace if the associatedifneeds a brace.