Skip to content

Commit

Permalink
[param-not-null-checked] Add a test that shows a false positive aroun…
Browse files Browse the repository at this point in the history
…d block parameters

Reviewed By: geralt-encore

Differential Revision: D65340454

fbshipit-source-id: 2c90033951f74bb668c00b3dfb112766257fd26a
  • Loading branch information
dulmarod authored and facebook-github-bot committed Nov 1, 2024
1 parent f06bc76 commit a19e6ce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
*/
#import <Foundation/Foundation.h>

typedef void (^NewAnnotateBlock1)(const char* _Nullable key,
id _Nullable value);
typedef void (^_Nullable NewAnnotateSyncBlock1)(NewAnnotateBlock1 annotate);

void MarkerAnnotateSync1(NS_NOESCAPE _Nullable NewAnnotateSyncBlock1 block) {}

void testAnnotateOk_FP(NSString* composerSessionID) {
MarkerAnnotateSync1(^(NewAnnotateBlock1 annotate) {
annotate("composer_session_id", composerSessionID);
});
}

typedef void (^MyBlock)();

typedef void (^MyBlock1)(int x);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockNotCheckedBad:and:, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockNotCheckedBad:and:,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block"@20:3
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockNotCheckedBad1:and:, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockNotCheckedBad1:and:,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block, "@24:3
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:, 2, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block1` of Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:,Executing `block1`], "block1("=>"BLOCK_CALL_SAFE(block1"@41:5
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:, 3, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block2` of Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:,Executing `block2`], "block2("=>"BLOCK_CALL_SAFE(block2"@42:5
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:, 4, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block2` of Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:,Executing `block2`], "block2("=>"BLOCK_CALL_SAFE(block2"@70:3
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockCheckedAssignNULLBad:and:, 3, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockCheckedAssignNULLBad:and:,Checking `block` for nil,Assigned,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block"@76:5
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, objc_block_Blocks_as_parameters.m:109, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `completion` of Blocks_as_parameters.uploadTaskWithRequestBad:fromFile:delegate:delegateQueue:completion:,Executing `completion`], "completion("=>"BLOCK_CALL_SAFE(completion"@110:5
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, objc_block_Blocks_as_parameters.m:16, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `annotate` of objc_block_Blocks_as_parameters.m:16,Executing `annotate`], "annotate("=>"BLOCK_CALL_SAFE(annotate, "@17:5
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockNotCheckedBad:and:, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockNotCheckedBad:and:,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block"@32:3
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockNotCheckedBad1:and:, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockNotCheckedBad1:and:,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block, "@36:3
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:, 2, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block1` of Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:,Executing `block1`], "block1("=>"BLOCK_CALL_SAFE(block1"@53:5
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:, 3, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block2` of Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:,Executing `block2`], "block2("=>"BLOCK_CALL_SAFE(block2"@54:5
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:, 4, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block2` of Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:,Executing `block2`], "block2("=>"BLOCK_CALL_SAFE(block2"@82:3
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockCheckedAssignNULLBad:and:, 3, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockCheckedAssignNULLBad:and:,Checking `block` for nil,Assigned,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block"@88:5
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, objc_block_Blocks_as_parameters.m:121, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `completion` of Blocks_as_parameters.uploadTaskWithRequestBad:fromFile:delegate:delegateQueue:completion:,Executing `completion`], "completion("=>"BLOCK_CALL_SAFE(completion"@122:5
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, objc_block_Blocks_as_parameters.m:213, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `annotate` of objc_block_Blocks_as_parameters.m:213,Executing `annotate`], "annotate("=>"BLOCK_CALL_SAFE(annotate, "@214:5
codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, blockNotCheckedBadNoAutofix, 0, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of blockNotCheckedBadNoAutofix,Executing `block`]

0 comments on commit a19e6ce

Please sign in to comment.