[clang-tools-extra] [WIP][clang-tidy] Ignore `if consteval` in else-after-return (PR #91588)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 9 06:01:14 PDT 2024
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 <joverzh at 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);
More information about the cfe-commits
mailing list