[all-commits] [llvm/llvm-project] 6cd72b: Reland "[clang] Don't add documentation comments t...
Anonmiraj via All-commits
all-commits at lists.llvm.org
Fri Oct 2 23:44:01 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6cd72b33224f0c3002b41e0e356eb2ab94ab3545
https://github.com/llvm/llvm-project/commit/6cd72b33224f0c3002b41e0e356eb2ab94ab3545
Author: Anonmiraj <ezzibrahimx at gmail.com>
Date: 2026-10-03 (Sat, 03 Oct 2026)
Changed paths:
M clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
M clang-tools-extra/clangd/Compiler.cpp
M clang-tools-extra/clangd/index/IndexAction.cpp
M clang/docs/ReleaseNotes.md
M clang/include/clang/Basic/CommentOptions.h
M clang/include/clang/Basic/Diagnostic.h
M clang/include/clang/Basic/DiagnosticIDs.h
M clang/include/clang/Basic/LangOptions.def
M clang/include/clang/Options/Options.td
M clang/include/clang/Sema/AnalysisBasedWarnings.h
M clang/include/clang/Sema/Sema.h
M clang/lib/AST/ASTContext.cpp
M clang/lib/Basic/Diagnostic.cpp
M clang/lib/Basic/DiagnosticIDs.cpp
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
M clang/lib/Frontend/ASTUnit.cpp
M clang/lib/Frontend/CompilerInvocation.cpp
M clang/lib/Frontend/FrontendActions.cpp
M clang/lib/Sema/AnalysisBasedWarnings.cpp
M clang/lib/Sema/Sema.cpp
M clang/lib/Sema/SemaAvailability.cpp
M clang/lib/Sema/SemaDecl.cpp
A clang/test/AST/ast-dump-comment-retention.cpp
A clang/test/Sema/Inputs/documentation-system-header-doc.h
A clang/test/Sema/Inputs/documentation-system-header.h
A clang/test/Sema/warn-documentation-comment-retention.cpp
A clang/test/Sema/warn-documentation-system-header-retained.cpp
A clang/test/Sema/warn-documentation-system-header.cpp
Log Message:
-----------
Reland "[clang] Don't add documentation comments to the AST if not requested (#206363)" (#221605)
The original PR caused a huge
[regression](https://llvm-compile-time-tracker.com/compare.php?from=aa1058e34a6127df91898829b0e60cbae3111cbf&to=e046dce4a4c80610b49d67bc02c85f86b1a6353d&stat=instructions:u)
The problem was that `areAllIgnored` ends up being called once per
declared entity, and each call walks all 26 diagnostics in
`-Wdocumentation` and `-Wdocumentation-pedantic`. So now the result is
cached and it's a performance
[improvement](https://llvm-compile-time-tracker.com/compare.php?from=5d063386f51b7d9925df7db5f05ec2f0a33f63c4&to=e8f7f96262a312739a990d1747a332ba6f1859b3&stat=instructions%3Au)
again.
The cache is keyed on the diagnostic state plus whether the location is
in a system header, because both change the answer. Keying it on the
state alone is wrong: a declaration coming from a system header would
cache "off" and silence the comments in the user's own code after it.
There is a test for that.
Also, Claude noticed that a similar thing is done in
`DoEmitAvailabilityWarning`, so i moved it out in the NFC to reuse it.
closes https://github.com/llvm/llvm-project/issues/165515
Assisted-By: Opus 5.
---------
Co-authored-by: Erich Keane <ekeane at nvidia.com>
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