Fix false positive BAD_POINTER for objcpp

Reviewed By: dulmarod

Differential Revision: D8658824

fbshipit-source-id: e582ce8
master
Martin Trojer 7 years ago committed by Facebook Github Bot
parent 3d63c34bd4
commit 8bdbf3aedc

@ -48,7 +48,7 @@ DEFINE-CHECKER BAD_POINTER_COMPARISON = {
OR is_binop_with_kind("LT") OR is_binop_with_kind("LE"))
AND
( (is_node("ImplicitCastExpr") AND has_type("NSNumber *")
AND (has_cast_kind("IntegralToPointer") OR has_cast_kind("NullToPointer"))
AND has_cast_kind("IntegralToPointer")
) HOLDS-NEXT);
LET root_is_stmt_expecting_bool =

@ -115,13 +115,6 @@ int good5(NSNumber* number, Simple* simple) {
return 1;
}
int bad7(NSNumber* number) {
if (number < 0) {
return 0;
}
return 1;
}
int bad8(NSNumber* number) {
if (number) {
return 0;

@ -20,17 +20,16 @@ codetoanalyze/objc/linters/atomic_prop.m, A_readQ, 84, POINTER_TO_INTEGRAL_IMPLI
codetoanalyze/objc/linters/atomic_prop.m, A_writeQ, 80, DIRECT_ATOMIC_PROPERTY_ACCESS, no_bucket, WARNING, []
codetoanalyze/objc/linters/atomic_prop.m, objc_block_1, 112, DIRECT_ATOMIC_PROPERTY_ACCESS, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad1, 15, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad10, 137, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad11, 146, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad12, 159, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad10, 130, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad11, 139, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad12, 152, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad2, 24, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad3, 31, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad4, 83, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad5, 97, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad6, 104, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad7, 119, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad8, 126, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad9, 133, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad8, 119, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/badpointer.m, bad9, 126, BAD_POINTER_COMPARISON, no_bucket, WARNING, []
codetoanalyze/objc/linters/implicit_cast.m, Implicit_cast_call_with_boxed_int, 67, POINTER_TO_INTEGRAL_IMPLICIT_CAST, no_bucket, WARNING, []
codetoanalyze/objc/linters/implicit_cast.m, Implicit_cast_call_with_string, 60, POINTER_TO_INTEGRAL_IMPLICIT_CAST, no_bucket, WARNING, []
codetoanalyze/objc/linters/implicit_cast.m, Implicit_cast_ivar_dictionary_item_call_funct_with_int, 45, POINTER_TO_INTEGRAL_IMPLICIT_CAST, no_bucket, WARNING, []

@ -0,0 +1,13 @@
/*
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/NSValue.h>
void good_nil_check(NSNumber* duration) {
if (duration != nil) {
}
}

@ -9,9 +9,10 @@ ANALYZER = linters
CLANG_OPTIONS = -x objective-c++ -std=c++11 -fobjc-arc -c
INFER_OPTIONS = --no-filtering --debug-exceptions --project-root $(TESTS_DIR) \
--enable-issue-type GLOBAL_VARIABLE_INITIALIZED_WITH_FUNCTION_OR_METHOD_CALL
INFERPRINT_OPTIONS = --issues-tests
INFERPRINT_OPTIONS = --issues-tests
SOURCES = \
$(wildcard *.mm) \
$(wildcard */*.mm) \
include $(TESTS_DIR)/clang.make

Loading…
Cancel
Save