[clang] [Wunsafe-buffer-usage] Turn off unsafe-buffer warning for methods annotated with clang::unsafe_buffer_usage attribute (PR #125671)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 6 04:14:32 PST 2025
================
@@ -2610,6 +2610,9 @@ void clang::sema::AnalysisBasedWarnings::IssueWarnings(
// The Callback function that performs analyses:
auto CallAnalyzers = [&](const Decl *Node) -> void {
+ if (isa<FunctionDecl>(Node) && Node->hasAttr<UnsafeBufferUsageAttr>())
----------------
Fznamznon wrote:
The attribute can be applied to a `FunctionDecl` or a `FieldDecl`.
Is the check `isa<FunctionDecl>(Node)` necessary? It seems the `CallableVisitor` won't do anything for `FieldDecl`s anyway.
https://github.com/llvm/llvm-project/pull/125671
More information about the cfe-commits
mailing list