[llvm-bugs] [Bug 25555] New: osx.cocoa.NSError checker false positive on overridden method

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 17 09:49:13 PST 2015


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

            Bug ID: 25555
           Summary: osx.cocoa.NSError checker false positive on overridden
                    method
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: levigroker at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15300
  --> https://llvm.org/bugs/attachment.cgi?id=15300&action=edit
Sample project demonstrating the issue.

The `osx.cocoa.NSError` checker reports an analysis warning on the child
implementation of an overridden method which would not pass the checker.

For instance, `NSFileCoordinator` declares `-
(void)coordinateReadingItemAtURL:(NSURL *)url
options:(NSFileCoordinatorReadingOptions)options error:(NSError **)outError
byAccessor:(void (^)(NSURL *))reader` which fails this checker (reports "Method
accepting NSError** should have a non-void return value to indicate whether or
not an error occurred"). A subclass of `NSFileCoordinator` which overrides this
method has no choice but to use the same method signature, and therefore will
fail the checker.

While it may be debatable this is to be considered a false positive, a couple
possible solutions come to mind:

1. Have the checker understand this is an overridden method and present the
warning on the parent class.
2. Provide a way to suppress this specific checker only for this and similar
overrides (perhaps via a #pragma push/pop mechanism).

Please see the attached Xcode 7.1.1 project, which exhibits this issue when
Xcode Analyze is performed.

Thank you,

Levi

-- 
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/20151117/213f4d10/attachment.html>


More information about the llvm-bugs mailing list