Reviewed By: jeremydubreil Differential Revision: D8989344 fbshipit-source-id: e716cb50bmaster
parent
6e44cae7cd
commit
46e2c153f1
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-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/NSString.h>
|
||||||
|
#import <string>
|
||||||
|
|
||||||
|
std::string stdStringOK(NSString* s) {
|
||||||
|
const char* s1 = [s UTF8String];
|
||||||
|
if (s1) {
|
||||||
|
std::string s2 = std::string([s UTF8String]);
|
||||||
|
return s2;
|
||||||
|
} else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string stdStringBad(NSString* s) {
|
||||||
|
std::string s2 = std::string([s UTF8String]);
|
||||||
|
return s2;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
# Copyright (c) 2017-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.
|
||||||
|
|
||||||
|
TESTS_DIR = ../../..
|
||||||
|
|
||||||
|
ANALYZER = checkers
|
||||||
|
CLANG_OPTIONS = -c
|
||||||
|
INFER_OPTIONS = --debug-exceptions --no-default-checkers --suggest-nullable --check-nullable --project-root $(TESTS_DIR)
|
||||||
|
INFERPRINT_OPTIONS = --issues-tests
|
||||||
|
|
||||||
|
SOURCES = $(wildcard *.mm)
|
||||||
|
|
||||||
|
include $(TESTS_DIR)/clang.make
|
||||||
|
|
||||||
|
infer-out/report.json: $(MAKEFILE_LIST)
|
@ -0,0 +1 @@
|
|||||||
|
codetoanalyze/objcpp/nullable/Examples.mm, stdStringBad, 1, NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereferencing the return of UTF8String,assignment of the nullable value,definition of UTF8String]
|
Loading…
Reference in new issue