https://github.com/JoverZhang created https://github.com/llvm/llvm-project/pull/91588
Fixes #91561. >From 19bf94ca3c093a6904482eab599f8366cad1384e Mon Sep 17 00:00:00 2001 From: Jover Zhang <jove...@gmail.com> Date: Thu, 9 May 2024 20:56:51 +0800 Subject: [PATCH] [clang-tidy] Ignore `if consteval` in else-after-return --- .../clang-tidy/readability/ElseAfterReturnCheck.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp b/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp index 1e85caf688355..3ee09b2e6442c 100644 --- a/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp @@ -317,6 +317,10 @@ void ElseAfterReturnCheck::check(const MatchFinder::MatchResult &Result) { return; } + if (If->isConsteval()) { + return; + } + DiagnosticBuilder Diag = diag(ElseLoc, WarningMessage) << ControlFlowInterruptor << SourceRange(ElseLoc); removeElseAndBrackets(Diag, *Result.Context, Else, ElseLoc); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits