[clang] [analyzer] Suppress optin.cplusplus.VirtualCall warnings in system headers (PR #184183)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 03:20:21 PST 2026


github-actions[bot] wrote:

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

* 53015 tests passed
* 993 tests skipped
* 1 test failed

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

### Clang
<details>
<summary>Clang.Analysis/virtualcall.cpp</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\23\include -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,optin.cplusplus.VirtualCall                     -analyzer-checker=debug.ExprInspection                     -std=c++11 -verify=impure C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\23\include' -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,optin.cplusplus.VirtualCall -analyzer-checker=debug.ExprInspection -std=c++11 -verify=impure 'C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp'
# note: command had no output on stdout or stderr
# RUN: at line 5
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\23\include -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,cplusplus.PureVirtualCall                     -analyzer-checker=debug.ExprInspection                     -std=c++11 -verify=pure -std=c++11 C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\23\include' -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,cplusplus.PureVirtualCall -analyzer-checker=debug.ExprInspection -std=c++11 -verify=pure -std=c++11 'C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp'
# note: command had no output on stdout or stderr
# RUN: at line 9
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\23\include -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,cplusplus.PureVirtualCall                     -analyzer-checker=optin.cplusplus.VirtualCall                     -analyzer-checker=debug.ExprInspection                     -std=c++11 -verify=pure,impure -std=c++11 C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\23\include' -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,cplusplus.PureVirtualCall -analyzer-checker=optin.cplusplus.VirtualCall -analyzer-checker=debug.ExprInspection -std=c++11 -verify=pure,impure -std=c++11 'C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp'
# note: command had no output on stdout or stderr
# RUN: at line 15
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\23\include -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,optin.cplusplus.VirtualCall                     -std=c++11 -verify=system C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\23\include' -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,optin.cplusplus.VirtualCall -std=c++11 -verify=system 'C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp'
# .---command stderr------------
# | error: 'system-warning' diagnostics seen but not expected: 
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.h Line 5: Call to virtual method 'Z::foo' during construction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp Line 45: Call to virtual method 'B::foo' during construction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp Line 51: Call to virtual method 'B::foo' during destruction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp Line 58: Call to virtual method 'B::foo' during destruction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp Line 71: Call to virtual method 'C::foo' during construction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp Line 125: Call to virtual method 'H::f' during construction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp Line 127: Call to virtual method 'H::f' during construction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp Line 134: Call to virtual method 'X::g' during construction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp Line 141: Call to virtual method 'X::g' during construction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp Line 162: Call to virtual method 'M::foo' during construction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# |   File C:\_work\llvm-project\llvm-project\clang\test\Analysis\virtualcall.cpp Line 170: Call to virtual method 'Y::foobar' during construction bypasses virtual dispatch [optin.cplusplus.VirtualCall]
# | 11 errors generated.
# `-----------------------------
# 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/184183


More information about the cfe-commits mailing list