[LLVMbugs] [Bug 18908] New: False positive when using a category on NSMutableArray

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 20 06:45:16 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18908

            Bug ID: 18908
           Summary: False positive when using a category on NSMutableArray
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: carsten.wenderdel at immobilienscout24.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

There seems to be a false positive in the current Xcode versions of the static
analyser (Xcode 5.0.2/5A3005 and 5.1/5B103i)

The warning is: "Arguments to 'NSMutableArray' method 'addObject:safe:' cannot
be nil"

The line with the warning is:
[myMutableArray addObject:someObjectThatCouldBeNil safe:YES];

This method is not part of Apples Code but added through a category by us:
- (void) addObject:(id)anObject safe:(BOOL)value {
    if (value) {
        if (anObject) {
            return [self addObject:anObject];
        }
        return;
    }
    return [self addObject:anObject];
}

The code seems fine to me as we check for nil values.

-- 
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/20140220/a2528042/attachment.html>


More information about the llvm-bugs mailing list