forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-tidy] ignore consteval function in
ExceptionAnalyzer
(llvm#1…
…16643) `ExceptionAnalyzer` can ignore `consteval` function even if it will throw exception. `consteval` function must produce compile-time constant. But throw statement cannot appear in constant evaluation. Fixed: llvm#104457.
- Loading branch information
1 parent
b62557a
commit fd2e048
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-consteval.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: %check_clang_tidy -std=c++20 %s bugprone-exception-escape %t -- \ | ||
// RUN: -- -fexceptions -Wno-everything | ||
|
||
namespace GH104457 { | ||
|
||
consteval int consteval_fn(int a) { | ||
if (a == 0) | ||
throw 1; | ||
return a; | ||
} | ||
|
||
int test() noexcept { return consteval_fn(1); } | ||
|
||
} // namespace GH104457 |