[llvm-bugs] [Bug 36220] New: Static analyzer checks have the wrong check name
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Feb 2 18:21:31 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36220
Bug ID: 36220
Summary: Static analyzer checks have the wrong check name
Product: clang
Version: unspecified
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: michael.eisel at gmail.com
CC: llvm-bugs at lists.llvm.org
Hi,
I'm working with the version of clang shipped with Xcode 9.0.1 (Apple LLVM
version 9.0.0 (clang-900.0.38)) and I seem to have found a bug where the
check_name parameter of the clang static analysis plist file is incorrect.
Since I use this check_name as an identifier for automatic linting in CI, it's
important to get it right (e.g., to track the change in violations across
commits). When I enable the lint nullability.NullPassedToNonnull, that check
name is returned for a violation that is actually
nullability.NullReturnedFromNonnull. When I disable
nullability.NullPassedToNonnull, the check_name is correctly reported.
Command where check_name is correct (nullability.NullReturnedFromNonnull):
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
-arch x86_64 -mios-simulator-version-min\=10.0 -std\=gnu99 -c a.m -o out
-Wno-error -Xclang -analyzer-config -Xclang mode\=deep -Xclang -analyzer-config
-Xclang path-diagnostics-alternate\=true -Xclang -analyzer-checker -Xclang
nullability.NullReturnedFromNonnull -Xclang -analyzer-disable-checker -Xclang
nullability.NullPassedToNonnull -Xclang -analyzer-output\=plist -Xclang
-analyzer-opt-analyze-nested-blocks -D__clang_analyzer__ --analyze && cat out
Command where check_name is NullPassedToNonnull:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
-arch x86_64 -mios-simulator-version-min\=10.0 -std\=gnu99 -c a.m -o out
-Wno-error -Xclang -analyzer-config -Xclang mode\=deep -Xclang -analyzer-config
-Xclang path-diagnostics-alternate\=true -Xclang -analyzer-checker -Xclang
nullability.NullReturnedFromNonnull -Xclang -analyzer-checker -Xclang
nullability.NullPassedToNonnull -Xclang -analyzer-output\=plist -Xclang
-analyzer-opt-analyze-nested-blocks -D__clang_analyzer__ --analyze && cat out
a.m:
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface MyObject : NSObject
- (id)foo;
@end
NS_ASSUME_NONNULL_END
@implementation MyObject
- (id)foo
{
return nil;
}
@end
Here's one response from a mailing list:
"It seems that we're using the same default CheckName for all nullability
checks, even though we retrieve the correct names in NullabilityChecker.cpp's
REGISTER_CHECKER - that's missing boilerplate for having the same checker
object in C++ code pretend to be multiple user-facing checkers. And we never
noticed only because nobody was using this field."
--
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/20180203/ac02bc1a/attachment.html>
More information about the llvm-bugs
mailing list