Summary: This shows that the current Pulse analyzer works fine in the C++ part of the Objc++ files. Reviewed By: martintrojer Differential Revision: D17225683 fbshipit-source-id: faf51c5famaster
parent
5c58689493
commit
41aa20e2b6
@ -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 $(OBJCPP_CLANG_OPTIONS)
|
||||||
|
INFER_OPTIONS = --pulse-only --debug-exceptions --project-root $(TESTS_DIR)
|
||||||
|
INFERPRINT_OPTIONS = --issues-tests
|
||||||
|
|
||||||
|
SOURCES = $(wildcard *.mm)
|
||||||
|
|
||||||
|
include $(TESTS_DIR)/clang.make
|
||||||
|
include $(TESTS_DIR)/objc.make
|
||||||
|
|
||||||
|
infer-out/report.json: $(MAKEFILE_LIST)
|
@ -0,0 +1,2 @@
|
|||||||
|
codetoanalyze/objcpp/pulse/use_after_delete.mm, PulseTest::deref_deleted_in_objc_method_bad, 3, USE_AFTER_DELETE, no_bucket, ERROR, [invalidation part of the trace starts here,assigned,memory was invalidated by `delete` here,use-after-lifetime part of the trace starts here,assigned,when calling `Simple::Simple()` here,invalid access occurs here]
|
||||||
|
codetoanalyze/objcpp/pulse/use_after_delete.mm, deref_deleted_bad, 3, USE_AFTER_DELETE, no_bucket, ERROR, [invalidation part of the trace starts here,assigned,memory was invalidated by `delete` here,use-after-lifetime part of the trace starts here,assigned,when calling `Simple::Simple()` here,invalid access occurs here]
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#import <Foundation/NSObject.h>
|
||||||
|
|
||||||
|
struct Simple {
|
||||||
|
int f;
|
||||||
|
};
|
||||||
|
|
||||||
|
@interface PulseTest : NSObject
|
||||||
|
|
||||||
|
- (int)deref_deleted_in_objc_method_bad;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation PulseTest
|
||||||
|
|
||||||
|
- (int)deref_deleted_in_objc_method_bad {
|
||||||
|
auto* s = new Simple{1};
|
||||||
|
delete s;
|
||||||
|
Simple tmp = *s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
void deref_deleted_bad() {
|
||||||
|
auto* s = new Simple{1};
|
||||||
|
delete s;
|
||||||
|
Simple tmp = *s;
|
||||||
|
}
|
Loading…
Reference in new issue