[clang-tools-extra] [clang-tidy] Add option 'IgnoredTypes' to bugprone-throwing-static-initialization (PR #192031)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 14 08:41:22 PDT 2026


=?utf-8?q?Balázs_Kéri?= <balazs.keri at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/192031 at github.com>


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 3130 tests passed
* 30 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Clang Tools
<details>
<summary>Clang Tools.clang-tidy/checkers/bugprone/throwing-static-initialization-ignore.cpp</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
C:/Python312/python.exe C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\throwing-static-initialization-ignore.cpp bugprone-throwing-static-initialization C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp --    -config="{CheckOptions:              {bugprone-throwing-static-initialization.IgnoredTypes: \"Ignore;^ns::S1$;^ns::Template<1>$\"}}"    -- -fexceptions
# executed command: C:/Python312/python.exe 'C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py' 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\throwing-static-initialization-ignore.cpp' bugprone-throwing-static-initialization 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp' -- '-config={CheckOptions:              {bugprone-throwing-static-initialization.IgnoredTypes: "Ignore;^ns::S1$;^ns::Template<1>$"}}' -- -fexceptions
# .---command stdout------------
# | Running ['clang-tidy', '--experimental-custom-checks', 'C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\bugprone\\Output\\throwing-static-initialization-ignore.cpp.tmp.cpp', '-fix', '--checks=-*,bugprone-throwing-static-initialization', '-config={CheckOptions:              {bugprone-throwing-static-initialization.IgnoredTypes: "Ignore;^ns::S1$;^ns::Template<1>$"}}', '--', '-fexceptions', '-std=c++11', '-nostdinc++', '-isystem', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\Inputs\\Headers\\std']...
# | ------------------------ clang-tidy output -----------------------
# | 8 warnings generated.
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:34:4: warning: initialization of 'VarThrow' with static storage duration may throw an exception that cannot be caught [bugprone-throwing-static-initialization]
# |    34 | S1 VarThrow;
# |       |    ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:7:3: note: possibly throwing constructor declared here
# |     7 |   S1() noexcept(false);
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:36:17: warning: initialization of 'VarTempl' with static storage duration may throw an exception that cannot be caught [bugprone-throwing-static-initialization]
# |    36 | ns::Template<2> VarTempl;
# |       |                 ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:23:3: note: possibly throwing constructor declared here
# |    23 |   Template() noexcept(false);
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:39:11: warning: initialization of 'VarIgnoreConstr' with static storage duration may throw an exception that cannot be caught [bugprone-throwing-static-initialization]
# |    39 | S1_Ignore VarIgnoreConstr;
# |       |           ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:11:3: note: possibly throwing constructor declared here
# |    11 |   S1_Ignore() noexcept(false);
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:40:11: warning: initialization of 'VarIgnoreInitF' with static storage duration may throw an exception that cannot be caught [bugprone-throwing-static-initialization]
# |    40 | S1_Ignore VarIgnoreInitF = getS1();
# |       |           ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:32:11: note: possibly throwing function declared here
# |    32 | S1_Ignore getS1() noexcept(false);
# |       |           ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:41:8: warning: initialization of 'VarIgnore2' with static storage duration may throw an exception that cannot be caught [bugprone-throwing-static-initialization]
# |    41 | ns::S1 VarIgnore2;
# |       |        ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:16:3: note: possibly throwing constructor declared here
# |    16 |   S1();
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:42:15: warning: initialization of 'VarIgnore3' with static storage duration may throw an exception that cannot be caught [bugprone-throwing-static-initialization]
# |    42 | ns::S1_Ignore VarIgnore3;
# |       |               ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:19:3: note: possibly throwing constructor declared here
# |    19 |   S1_Ignore();
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:43:22: warning: initialization of 'VarIgnore4' with static storage duration may throw an exception that cannot be caught [bugprone-throwing-static-initialization]
# |    43 | TemplateIgnored<int> VarIgnore4;
# |       |                      ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:29:3: note: possibly throwing constructor declared here
# |    29 |   TemplateIgnored() noexcept(false);
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:44:17: warning: initialization of 'VarIgnore5' with static storage duration may throw an exception that cannot be caught [bugprone-throwing-static-initialization]
# |    44 | ns::Template<1> VarIgnore5;
# |       |                 ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:23:3: note: possibly throwing constructor declared here
# |    23 |   Template() noexcept(false);
# |       |   ^
# | 
# | ------------------------------------------------------------------
# | ------------------------------ Fixes -----------------------------
# | 
# | ------------------------------------------------------------------
# | FileCheck -input-file=C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp.msg C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\throwing-static-initialization-ignore.cpp -check-prefixes=CHECK-MESSAGES -implicit-check-not={{warning|error}}: failed:
# | command line:1:22: error: IMPLICIT-CHECK-NOT: excluded string found in input
# | 
# | -implicit-check-not='{{warning|error}}:'
# | 
# |                      ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp.msg:14:164: note: found here
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:39:11: warning: initialization of 'VarIgnoreConstr' with static storage duration may throw an exception that cannot be caught [bugprone-throwing-static-initialization]
# | 
# |                                                                                                                                                                    ^~~~~~~~
# | 
# | 
# | 
# | Input file: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp.msg
# | 
# | Check file: C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\throwing-static-initialization-ignore.cpp
# | 
# | 
# | 
# | -dump-input=help explains the following input dump.
# | 
# | 
# | 
# | Input was:
# | 
# | <<<<<<
# | 
# |           .
# | 
# |           .
# | 
# |           .
# | 
# |           9:  36 | ns::Template<2> VarTempl; 
# | 
# |          10:  | ^ 
# | 
# |          11: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:23:3: note: possibly throwing constructor declared here 
# | 
# |          12:  23 | Template() noexcept(false); 
# | 
# |          13:  | ^ 
# | 
# |          14: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:39:11: warning: initialization of 'VarIgnoreConstr' with static storage duration may throw an exception that cannot be caught [bugprone-throwing-static-initialization] 
# | 
# | not:imp1                                                                                                                                                                        !~~~~~~~                                                                                                                                                          error: no match expected
# | 
# |          15:  39 | S1_Ignore VarIgnoreConstr; 
# | 
# |          16:  | ^ 
# | 
# |          17: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\throwing-static-initialization-ignore.cpp.tmp.cpp:11:3: note: possibly throwing constructor declared here 
# | 
# |          18:  11 | S1_Ignore() noexcept(false); 
# | 
# |          19:  | ^ 
# | 
# |           .
# | 
# |           .
# | 
# |           .
# | 
# | >>>>>>
# | 
# | 
# `-----------------------------
# .---command stderr------------
# | Traceback (most recent call last):
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 554, in <module>
# |     main()
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 550, in main
# |     CheckRunner(args, extra_args).run()
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 433, in run
# |     self.check_messages(main_output)
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 358, in check_messages
# |     try_run(
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 64, in try_run
# |     process_output = subprocess.check_output(args, stderr=subprocess.STDOUT).decode(
# |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# |   File "c:\python312\Lib\subprocess.py", line 466, in check_output
# |     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
# |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# |   File "c:\python312\Lib\subprocess.py", line 571, in run
# |     raise CalledProcessError(retcode, process.args,
# | subprocess.CalledProcessError: Command '['FileCheck', '-input-file=C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\bugprone\\Output\\throwing-static-initialization-ignore.cpp.tmp.cpp.msg', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\bugprone\\throwing-static-initialization-ignore.cpp', '-check-prefixes=CHECK-MESSAGES', '-implicit-check-not={{warning|error}}:']' returned non-zero exit status 1.
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/192031


More information about the cfe-commits mailing list