[PATCH] D24411: [Analyzer] Suppress false positives on the clang static analyzer
Nikhil Gupta via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 9 10:45:25 PDT 2016
nikhgupt created this revision.
nikhgupt added reviewers: zaks.anna, bcraig, hiraditya, dcoughlin.
nikhgupt added a subscriber: cfe-commits.
There is a need for suppressing static analyzer warnings in specific parts of a source file (usually for silencing known false positives).
This change allows a user to suppress the static analyzer on a line-by-line basis using the comment: //clang_sa_ignore[<specific checker here>]
eg:
int b = 5;
int c = 0;
int tx = b/c; // clang_sa_ignore [core.DivideZero]
If there is more than one warning associated with the line that you would like to suppress, then provide a comma separated list of ids:
// clang_sa_ignore [<id1>,<id2>,<id3>]
The user must annotate the specified checker(s). In order to do this, the analyzer warnings contain the identity of the checker being invoked. The warning message will be of the form:
<file name>:<line number>:<column number>:clang_sa_warning: <warning text> [<id>]
eg: /local/mnt/workspace/analyzer-ignore.cpp:65:13: clang_sa_warning: Division by zero [core.DivideZero]
https://reviews.llvm.org/D24411
Files:
include/clang/Basic/DiagnosticOptions.def
include/clang/Frontend/CompilerInstance.h
include/clang/Frontend/SuppressDiagConsumer.h
include/clang/Frontend/TextDiagnostic.h
include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
include/clang/StaticAnalyzer/Frontend/FrontendActions.h
lib/Frontend/CompilerInstance.cpp
lib/Frontend/CompilerInvocation.cpp
lib/Frontend/TextDiagnostic.cpp
lib/Frontend/TextDiagnosticPrinter.cpp
lib/Frontend/VerifyDiagnosticConsumer.cpp
lib/FrontendTool/ExecuteCompilerInvocation.cpp
lib/StaticAnalyzer/Core/AnalysisManager.cpp
lib/StaticAnalyzer/Core/BugReporter.cpp
lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
test/Analysis/MismatchedDeallocator-path-notes.cpp
test/Analysis/NewDelete-path-notes.cpp
test/Analysis/analyzer-ignore.cpp
test/Analysis/analyzer-warning.c
test/Analysis/bug_hash_test.cpp
test/Analysis/bug_hash_test.m
test/Analysis/conditional-path-notes.c
test/Analysis/cxx-for-range.cpp
test/Analysis/diagnostics/deref-track-symbolic-region.c
test/Analysis/diagnostics/report-issues-within-main-file.cpp
test/Analysis/diagnostics/text-diagnostics.c
test/Analysis/diagnostics/undef-value-caller.c
test/Analysis/diagnostics/undef-value-param.c
test/Analysis/diagnostics/undef-value-param.m
test/Analysis/edges-new.mm
test/Analysis/explain-svals.cpp
test/Analysis/generics.m
test/Analysis/inline-plist.c
test/Analysis/inline-unique-reports.c
test/Analysis/inlining/eager-reclamation-path-notes.c
test/Analysis/inlining/eager-reclamation-path-notes.cpp
test/Analysis/inlining/path-notes.c
test/Analysis/inlining/path-notes.cpp
test/Analysis/inlining/path-notes.m
test/Analysis/lambda-notes.cpp
test/Analysis/malloc-plist.c
test/Analysis/method-call-path-notes.cpp
test/Analysis/model-file.cpp
test/Analysis/null-deref-path-notes.m
test/Analysis/objc-arc.m
test/Analysis/objc-radar17039661.m
test/Analysis/plist-macros.cpp
test/Analysis/plist-output-alternate.m
test/Analysis/plist-output.m
test/Analysis/retain-release-path-notes-gc.m
test/Analysis/retain-release-path-notes.m
test/Analysis/unix-fns.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24411.70861.patch
Type: text/x-patch
Size: 428462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160909/56f03d9e/attachment-0001.bin>
More information about the cfe-commits
mailing list