[analyzer] NonnullGlobalConstants: Don't be confused by a _Nonnull attribute.
authorArtem Dergachev <artem.dergachev@gmail.com>
Mon, 1 Jul 2019 23:02:14 +0000 (23:02 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Mon, 1 Jul 2019 23:02:14 +0000 (23:02 +0000)
commit512f4838c47c5bab13d8bb0eabc01d64222825ae
tree254edeea96759e115a9e20b02bcae713b432567c
parent35fdec1b54c6a8b1ca7bee542836abf29c75a85d
[analyzer] NonnullGlobalConstants: Don't be confused by a _Nonnull attribute.

The NonnullGlobalConstants checker models the rule "it doesn't make sense
to make a constant global pointer and initialize it to null"; it makes sure
that whatever it's initialized with is known to be non-null.

Ironically, annotating the type of the pointer as _Nonnull breaks the checker.

Fix handling of the _Nonnull annotation so that it was instead one more reason
to believe that the value is non-null.

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

llvm-svn: 364869
clang/lib/StaticAnalyzer/Checkers/NonnullGlobalConstantsChecker.cpp
clang/test/Analysis/nonnull-global-constants.mm