[clang] [analyzer] Suppress optin.cplusplus.VirtualCall warnings in system headers (PR #184183)
Tarun Thammisetty via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 4 22:22:41 PST 2026
tarun-t wrote:
We hit this with `Boost.Asio`. The specific pattern:
`boost::asio::ip::tcp::resolver` registers a service with `io_context` (which inherits `execution_context`). The execution_context destructor iterates its service list and calls the `virtual shutdown()` on each service. This is a safe, intentional pattern — the services are always most-derived when `shutdown()` is called — but the analyzer flags it because the call site is inside execution_context's destructor in a system header.
To @haoNoQ's point about template algorithms: `Boost.Asio`'s service model is exactly this kind of pattern — a system-header class (`execution_context`) managing internally-created service objects with virtual shutdown(). No user code is involved in the dispatch at all; the entire call chain lives within Boost's headers.
https://github.com/llvm/llvm-project/pull/184183
More information about the cfe-commits
mailing list