[PATCH] D93110: [analyzer] Implement a first version of suppressions via attributes
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 11 05:50:59 PST 2020
vsavchenko created this revision.
Herald added subscribers: steakhal, ASDenysPetrov, martong, Charusso, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a reviewer: aaron.ballman.
vsavchenko requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
At the moment, the only possible way to suppress analyzer warnings
is by cutting the code out with #ifdef. It is practically impossible
to do locally, so whole functions should stay not analyzed.
This patch suggests how we can use `__attribute__((suppress))`
for these purposes. Even without specifying checker IDs, it is
far more precise than the existing practice. It can be applied
to statements in question. Its proximity to the warning and
the fact that this is part of the code, drastically increases
its chances to survive code refactoring.
Further on, when we decide on stable checker identifiers, we
can implement finer approach, where the user can specify those
to suppress specific checks. Current code still can be relevant
as it gives "suppress all" option, which is usally enough.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93110
Files:
clang/include/clang/Basic/Attr.td
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaStmtAttr.cpp
clang/lib/StaticAnalyzer/Core/BugReporter.cpp
clang/test/Analysis/suppression-attr.m
clang/test/SemaCXX/suppress.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93110.311196.patch
Type: text/x-patch
Size: 11944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201211/fe20a82d/attachment-0001.bin>
More information about the cfe-commits
mailing list