Update coding standards for constexpr if statements; NFC
authorAaron Ballman <aaron@aaronballman.com>
Fri, 19 Aug 2022 19:51:53 +0000 (15:51 -0400)
committerAaron Ballman <aaron@aaronballman.com>
Fri, 19 Aug 2022 19:53:19 +0000 (15:53 -0400)
commitcda093681bad901e64d0f6898d15121ab49cb074
tree0f0973bccc2176739e1183b0df47291698ee32ba
parente412bac9125a806d147f4f545dd057fac0b4a8f0
Update coding standards for constexpr if statements; NFC

We currently suggest that users not use an else clause after a return
statement in a prior if branch. e.g.,

if (foo)
  return 1;
else // Should remove this else clause
  return 10;

however, this suggestion is incorrect for a constexpr if statement
because one of the two branches will be a discarded statement and thus
can impact template instantiation behavior. This updates the coding
standard to make it clear that it's okay to have a return after an else
in a constexpr if statement.

I think this is an NFC change to the intent of the rule, which is why
I've not started an RFC for the changes.

Differential Revision: https://reviews.llvm.org/D132232
llvm/docs/CodingStandards.rst