[all-commits] [llvm/llvm-project] 8c22f5: [Fix] Speedup -Wunsafe-buffer-usage when using cla...
Matt via All-commits
all-commits at lists.llvm.org
Mon Apr 14 19:17:24 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8c22f569b3b19450034832769ef77d5b2ec997d7
https://github.com/llvm/llvm-project/commit/8c22f569b3b19450034832769ef77d5b2ec997d7
Author: Matt <mattstark75 at gmail.com>
Date: 2025-04-15 (Tue, 15 Apr 2025)
Changed paths:
M clang/lib/Sema/AnalysisBasedWarnings.cpp
M clang/test/Modules/safe_buffers_optout.cpp
Log Message:
-----------
[Fix] Speedup -Wunsafe-buffer-usage when using clang modules. (#127161)
Each piece of code should have analysis run on it precisely once.
However, if you build a module, and then build another module depending
on it, the header file of the module you depend on will have
`-Wunsafe-buffer-usage` run on it twice. This normally isn't a huge
issue, but in the case of using the standard library as a module, simply
adding the line `#include <cstddef>` increases compile times by 900ms
(from 100ms to 1 second) on my machine. I believe this is because the
standard library has massive modules, of which only a small part is used
(the AST is ~700k lines), and because if what I've been told is correct,
the AST is lazily generated, and `-Wunsafe-buffer-usage` forces it to be
evaluated every time.
See https://issues.chromium.org/issues/351909443 for details and
benchmarks.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list