]> granicus.if.org Git - clang/commit
[analyzer][UninitializedObjectChecker] New flag to ignore guarded uninitialized fields
authorKristof Umann <dkszelethus@gmail.com>
Sat, 2 Feb 2019 14:50:04 +0000 (14:50 +0000)
committerKristof Umann <dkszelethus@gmail.com>
Sat, 2 Feb 2019 14:50:04 +0000 (14:50 +0000)
commit8f798fb970dce065ff94922a097296256e875c8a
tree8f45bfbbb9b6fe4ecad6735a3c5c4cb3baaf9225
parent64bb5ec169812550e9e965f500665e357d9d7276
[analyzer][UninitializedObjectChecker] New flag to ignore guarded uninitialized fields

This patch is an implementation of the ideas discussed on the mailing list[1].

The idea is to somewhat heuristically guess whether the field that was confirmed
to be uninitialized is actually guarded with ifs, asserts, switch/cases and so
on. Since this is a syntactic check, it is very much prone to drastically
reduce the amount of reports the checker emits. The reports however that do not
get filtered out though have greater likelihood of them manifesting into actual
runtime errors.

[1] http://lists.llvm.org/pipermail/cfe-dev/2018-September/059255.html

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352959 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
test/Analysis/cxx-uninitialized-object-unguarded-access.cpp [new file with mode: 0644]