[clang][diagnostics] Don't warn about unreachable code in constexpr if
authorAlan Zhao <ayzhao@google.com>
Fri, 12 Aug 2022 23:39:26 +0000 (19:39 -0400)
committerAlan Zhao <ayzhao@google.com>
Mon, 15 Aug 2022 19:24:39 +0000 (15:24 -0400)
commitff8aadf58d1a0ea7d8fa2b9a7a17ff0c6059baa5
tree0fc5e8982cfce5f7c5bf77ba73891205150c2f0d
parent3a8d7fe20199aa73590d7a240ac9376624203b7f
[clang][diagnostics] Don't warn about unreachable code in constexpr if

The point of a constexpr if statement is to determine which branch to
take at compile time, so warning on unreachable code is meaningless in
these situations.

Fixes #57123.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D131818
clang/lib/Analysis/ReachableCode.cpp
clang/test/SemaCXX/unreachable-code.cpp