[pulse] Add pulse tests for objective-c (the c part of it)

Reviewed By: ngorogiannis

Differential Revision: D17183375

fbshipit-source-id: 0ecdf2072
master
Dulma Churchill 5 years ago committed by Facebook Github Bot
parent 27ea5d041b
commit 5c58689493

@ -105,6 +105,7 @@ DIRECT_TESTS += \
objc_liveness \
objc_nullable \
objc_performance \
objc_pulse \
objc_quandary \
objc_uninit \
objcpp_errors \

@ -0,0 +1,17 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
TESTS_DIR = ../../..
CLANG_OPTIONS = -c $(OBJC_CLANG_OPTIONS)
INFER_OPTIONS = --pulse-only --debug-exceptions --project-root $(TESTS_DIR)
INFERPRINT_OPTIONS = --issues-tests
SOURCES = $(wildcard *.m)
include $(TESTS_DIR)/clang.make
include $(TESTS_DIR)/objc.make
infer-out/report.json: $(MAKEFILE_LIST)

@ -0,0 +1,2 @@
codetoanalyze/objc/pulse/use_after_free.m, PulseTest::use_after_free_simple_in_objc_method_bad:, 2, USE_AFTER_FREE, no_bucket, ERROR, [invalidation part of the trace starts here,memory was invalidated by call to `free()` here,use-after-lifetime part of the trace starts here,invalid access occurs here]
codetoanalyze/objc/pulse/use_after_free.m, use_after_free_simple_bad, 2, USE_AFTER_FREE, no_bucket, ERROR, [invalidation part of the trace starts here,memory was invalidated by call to `free()` here,use-after-lifetime part of the trace starts here,invalid access occurs here]

@ -0,0 +1,27 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/NSObject.h>
@interface PulseTest : NSObject
- (int)use_after_free_simple_in_objc_method_bad:(int*)x;
@end
@implementation PulseTest
- (int)use_after_free_simple_in_objc_method_bad:(int*)x {
free(x);
return *x;
}
@end
int use_after_free_simple_bad(int* x) {
free(x);
return *x;
}
Loading…
Cancel
Save