[llvm-bugs] [Bug 33280] New: Add strict checker for nullability

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 2 09:33:17 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33280

            Bug ID: 33280
           Summary: Add strict checker for nullability
           Product: clang
           Version: 4.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: michael.eisel at gmail.com
                CC: llvm-bugs at lists.llvm.org

The _Nonnull and _Nullable annotations seem mainly focused on preventing the
literal "nil" being passed into a method or set for a nonnull property.
However, this is much more relaxed than Swift's null checking. It would be
great if we could statically analyze if what was being passed in as a nonnull
parameter was nonnull itself. It could recognize if a nullable variable was
being used in a way that made it nonnull.

For example:
if (!x) {
  return;
}
[self runWithNonnullArg:x];

or

[self runWithNonnullArg:(x ?: @"")];

Both of these would be pass the static analysis.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170602/03096780/attachment-0001.html>


More information about the llvm-bugs mailing list