[AL] Allow to match typedefs and pointers.

Differential Revision: D18779850

fbshipit-source-id: 9a0b09446
master
Dulma Churchill 5 years ago committed by Facebook Github Bot
parent fbe1c92c17
commit d00d8b3597

@ -558,7 +558,8 @@ and c_type_equal c_type abs_ctype =
| ElaboratedType ti, TypeName _
| AutoType ti, TypeName _
| TypedefType (ti, _), ObjCGenProt _
| AttributedType (ti, _), Pointer _ -> (
| AttributedType (ti, _), Pointer _
| TypedefType (ti, _), Pointer _ -> (
match ti.ti_desugared_type with Some dt -> check_type_ptr dt abs_ctype | None -> false )
| AttributedType (ti, _), TypeName _ -> (
match ti.ti_desugared_type with Some dt -> check_type_ptr dt abs_ctype | None -> false )

@ -9,6 +9,9 @@
static CFStringRef CreateFoo() {
return CFStringCreateWithCString(NULL, "Hello", kCFStringEncodingUTF8);
}
static _Nullable CFStringRef CreateNullableFoo() {
return CFStringCreateWithCString(NULL, "Hello", kCFStringEncodingUTF8);
}
static void doSomething(CFStringRef s) { CFShow(s); }
@ -18,7 +21,7 @@ static void Foo() {}
int main() {
doSomething(CreateFoo());
doSomethingElse(0, CreateFoo());
doSomethingElse(0, CreateNullableFoo());
Foo();
return 0;
}

@ -891,7 +891,7 @@ DEFINE-CHECKER IVAR_CAPTURED_IN_OBJC_BLOCK = {
DEFINE-CHECKER CALLS_TO_FUNCTIONS_WITH_CREATE_FUNCTION_PARAMETERS = {
LET is_create_method_parameter = HOLDS-NEXT WITH-TRANSITION Parameters
(call_function(REGEXP(".*Create.*")) AND has_type("REGEXP('C.*Ref')"));
(call_function(REGEXP(".*Create.*")) AND has_type("REGEXP('__C.+')*"));
SET report_when =
WHEN
is_create_method_parameter

@ -1,9 +1,9 @@
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 19, ALL_PATH_NO_FILTER_EXAMPLE, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 19, BLACKLIST_PATH_EXAMPLE, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 19, FILTER_BY_ALL_PATH_EXAMPLE, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 19, WHITE_BLACKLIST_PATH_EXAMPLE, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 20, CALLS_TO_FUNCTIONS_WITH_CREATE_FUNCTION_PARAMETERS, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 21, CALLS_TO_FUNCTIONS_WITH_CREATE_FUNCTION_PARAMETERS, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 22, ALL_PATH_NO_FILTER_EXAMPLE, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 22, BLACKLIST_PATH_EXAMPLE, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 22, FILTER_BY_ALL_PATH_EXAMPLE, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 22, WHITE_BLACKLIST_PATH_EXAMPLE, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 23, CALLS_TO_FUNCTIONS_WITH_CREATE_FUNCTION_PARAMETERS, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CFStringExample.m, main, 24, CALLS_TO_FUNCTIONS_WITH_CREATE_FUNCTION_PARAMETERS, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CallingAMethodWithSelf.m, CallingAMethodWithSelf::methodThatShallBeOkaySuper, 35, TEST_IS_RECEIVER_SUPER, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CallingAMethodWithSelf.m, CallingAMethodWithSelf::methodThatShallComplain, 38, TEST_IS_METHOD_EXPOSED, no_bucket, WARNING, []
codetoanalyze/objc/linters-for-test-only/CallingAMethodWithSelf.m, CallingAMethodWithSelf::methodThatShallComplain, 39, TEST_IF_VIEW_METHOD_IS_NOT_CALLED_WITH_SUPER, no_bucket, WARNING, []

Loading…
Cancel
Save