[analyzer] Add minimal support for fix-it hints.
authorArtem Dergachev <artem.dergachev@gmail.com>
Fri, 6 Sep 2019 20:55:29 +0000 (20:55 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Fri, 6 Sep 2019 20:55:29 +0000 (20:55 +0000)
commit6cee434ed10ead6b7416ca5ee9592b2b207eeb0f
tree8af15b8d39c1d88aff40f5bef27e77279f787ba7
parent2b1b4cab9605a33a6c90079b44bdddf048104e08
[analyzer] Add minimal support for fix-it hints.

Allow attaching fixit hints to Static Analyzer BugReports.

Fixits are attached either to the bug report itself or to its notes
(path-sensitive event notes or path-insensitive extra notes).

Add support for fixits in text output (including the default text output that
goes without notes, as long as the fixit "belongs" to the warning).

Add support for fixits in the plist output mode.

Implement a fixit for the path-insensitive DeadStores checker. Only dead
initialization warning is currently covered.

Implement a fixit for the path-sensitive VirtualCall checker when the virtual
method is not pure virtual (in this case the "fix" is to suppress the warning
by qualifying the call).

Both fixits are under an off-by-default flag for now, because they
require more careful testing.

Differential Revision: https://reviews.llvm.org/D65182

llvm-svn: 371257
15 files changed:
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
clang/lib/StaticAnalyzer/Core/BugReporter.cpp
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
clang/test/Analysis/analyzer-config.c
clang/test/Analysis/dead-stores.c
clang/test/Analysis/edges-new.mm
clang/test/Analysis/objc-arc.m
clang/test/Analysis/plist-output.m
clang/test/Analysis/virtualcall-fixits.cpp [new file with mode: 0644]