Reviewed By: jvillard

Differential Revision: D18748966

fbshipit-source-id: 23aa4574f
master
Martin Trojer 5 years ago committed by Facebook Github Bot
parent f73671a5dd
commit fbe1c92c17

@ -1 +1 @@
Subproject commit f691096a2d34b81da7d6b05bfd4fffa280472f09
Subproject commit 26e9e058b770aac2c90823549fd4c889e3064577

@ -218,6 +218,9 @@ let get_struct_decls decl =
decl_list
| AccessSpecDecl _
| BlockDecl _
| ConceptDecl _
| OMPDeclareMapperDecl _
| OMPAllocateDecl _
| ClassScopeFunctionSpecializationDecl _
| EmptyDecl _
| ExportDecl _

@ -148,7 +148,7 @@ let filter_and_replace_unsupported_args ?(replace_options_arg = fun _ s -> s) ?(
let clang_cc1_cmd_sanitizer cmd =
let replace_args arg = function
| Some override_regex when Str.string_match override_regex arg 0 ->
fcp_dir ^/ "clang" ^/ "install" ^/ "lib" ^/ "clang" ^/ "8.0.0" ^/ "include"
fcp_dir ^/ "clang" ^/ "install" ^/ "lib" ^/ "clang" ^/ "9.0.0" ^/ "include"
| _ ->
arg
in

@ -182,6 +182,9 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron
| EmptyDecl _ | ObjCIvarDecl _ | ObjCPropertyDecl _ | ObjCInterfaceDecl _ ->
()
| AccessSpecDecl _
| ConceptDecl _
| OMPDeclareMapperDecl _
| OMPAllocateDecl _
| BlockDecl _
| CapturedDecl _
| ClassScopeFunctionSpecializationDecl _

@ -3433,6 +3433,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
unaryExprOrTypeTraitExpr_trans trans_state unary_expr_or_type_trait_expr_info
| ObjCBridgedCastExpr (stmt_info, stmt_list, expr_info, cast_kind, _)
| ImplicitCastExpr (stmt_info, stmt_list, expr_info, cast_kind)
| BuiltinBitCastExpr (stmt_info, stmt_list, expr_info, cast_kind, _)
| CStyleCastExpr (stmt_info, stmt_list, expr_info, cast_kind, _)
| CXXReinterpretCastExpr (stmt_info, stmt_list, expr_info, cast_kind, _, _)
| CXXConstCastExpr (stmt_info, stmt_list, expr_info, cast_kind, _, _)
@ -3683,6 +3684,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| OMPTaskwaitDirective _
| OMPTaskyieldDirective _
| OMPTeamsDirective _
| SourceLocExpr _
| SEHExceptStmt _
| SEHFinallyStmt _
| SEHLeaveStmt _

@ -44,9 +44,9 @@ codetoanalyze/cpp/errors/models/cmp.cpp, std_less_equal_bad, 4, NULL_DEREFERENCE
codetoanalyze/cpp/errors/models/cmp.cpp, std_not_equal_to_bad, 4, NULL_DEREFERENCE, B1, ERROR, [start of procedure std_not_equal_to_bad(),Condition is false,Taking true branch]
codetoanalyze/cpp/errors/models/move.cpp, move::div0_moved_from, 3, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure move::div0_moved_from(),start of procedure X,return from a call to move::X::X,start of procedure X,return from a call to move::X::X]
codetoanalyze/cpp/errors/models/move.cpp, move::div0_moved_to, 3, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure move::div0_moved_to(),start of procedure X,return from a call to move::X::X,start of procedure X,return from a call to move::X::X]
codetoanalyze/cpp/errors/models/pair.cpp, pair::deref_pair_null0_bad, 3, NULL_DEREFERENCE, B1, ERROR, [start of procedure pair::deref_pair_null0_bad(),start of procedure pair::pairOfZeroNull(),Skipping ~pair: method has no implementation,return from a call to pair::pairOfZeroNull,Skipping ~pair: method has no implementation]
codetoanalyze/cpp/errors/models/pair.cpp, pair::deref_pair_null1_bad, 3, NULL_DEREFERENCE, B5, ERROR, [start of procedure pair::deref_pair_null1_bad(),start of procedure pair::pairOfZeroNull(),Skipping ~pair: method has no implementation,return from a call to pair::pairOfZeroNull,Skipping ~pair: method has no implementation]
codetoanalyze/cpp/errors/models/pair.cpp, pair::deref_pair_null3_bad, 3, NULL_DEREFERENCE, B1, ERROR, [start of procedure pair::deref_pair_null3_bad(),start of procedure pair::pairOfZeroNull2(),Skipping ~pair: method has no implementation,return from a call to pair::pairOfZeroNull2,Skipping ~pair: method has no implementation]
codetoanalyze/cpp/errors/models/pair.cpp, pair::deref_pair_null0_bad_FN, 3, DANGLING_POINTER_DEREFERENCE, no_bucket, ERROR, [start of procedure pair::deref_pair_null0_bad_FN(),start of procedure pair::pairOfZeroNull(),Skipping ~pair: method has no implementation,return from a call to pair::pairOfZeroNull,Skipping ~pair: method has no implementation]
codetoanalyze/cpp/errors/models/pair.cpp, pair::deref_pair_null1_bad, 3, DANGLING_POINTER_DEREFERENCE, no_bucket, ERROR, [start of procedure pair::deref_pair_null1_bad(),start of procedure pair::pairOfZeroNull(),Skipping ~pair: method has no implementation,return from a call to pair::pairOfZeroNull,Skipping ~pair: method has no implementation]
codetoanalyze/cpp/errors/models/pair.cpp, pair::deref_pair_null_guard_ok_FP, 4, DANGLING_POINTER_DEREFERENCE, no_bucket, ERROR, [start of procedure pair::deref_pair_null_guard_ok_FP(),start of procedure pair::pairOfZeroNull(),Skipping ~pair: method has no implementation,return from a call to pair::pairOfZeroNull,Skipping ~pair: method has no implementation,Taking true branch]
codetoanalyze/cpp/errors/models/swap.cpp, swap_null_bad, 4, NULL_DEREFERENCE, B1, ERROR, [start of procedure swap_null_bad()]
codetoanalyze/cpp/errors/models/throw_wrapper.cpp, nothrow_if_null_bad, 4, NULL_DEREFERENCE, B1, ERROR, [start of procedure nothrow_if_null_bad(),start of procedure get_null(),return from a call to get_null,Taking true branch,start of procedure do_nothing(),return from a call to do_nothing]
codetoanalyze/cpp/errors/mutex/std_mutex.cpp, ends_locked, 3, Cannot_star, no_bucket, ERROR, [start of procedure ends_locked(),Loop condition is true. Entering loop body,start of procedure ensure_unlocked(),start of procedure ensure_locked(),Skipping try_lock: method has no implementation,return from a call to ensure_locked,Skipping unlock: method has no implementation,return from a call to ensure_unlocked]

@ -16,7 +16,9 @@ std::pair<int, int*> pairOfZeroNull() {
std::pair<int, int*> pairOfZeroNull2() { return std::make_pair(0, nullptr); }
int deref_pair_null0_bad() {
// there are reported as DANGLING_POINTER_DEREFERENCE
// but should really be NULL_DEREFERENCE
int deref_pair_null0_bad_FN() {
auto p = pairOfZeroNull();
// Should report an NPE here as p.second is NULL
return p.first + *p.second;
@ -28,13 +30,13 @@ int deref_pair_null1_bad() {
return std::get<0>(p) + *std::get<1>(p);
}
int deref_pair_null3_bad() {
int deref_pair_null3_bad_FN() {
auto p = pairOfZeroNull2();
// Should report an NPE here as p.second is NULL
return p.first + *p.second;
}
int deref_pair_null_guard_ok() {
int deref_pair_null_guard_ok_FP() {
auto p = pairOfZeroNull();
if (p.second != nullptr) {
// Should not report an NPE here as p.second is guarded

@ -14,26 +14,30 @@ digraph cfg {
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_1" [label="1: Start init_list::list_init\nFormals: \nLocals: ty:init_list::Y[3*24] yref:init_list::Y& y:init_list::Y ti:int[4*4] \n " color=yellow style=filled]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_1" -> "list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_6" ;
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_1" -> "list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_7" ;
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_2" [label="2: Exit init_list::list_init \n " color=yellow style=filled]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_3" [label="3: DeclStmt \n VARIABLE_DECLARED(ty:init_list::Y[3*24]); [line 48, column 3]\n *&ty[0].z:int=1 [line 48, column 14]\n *&ty[0].x.a:int=2 [line 48, column 18]\n *&ty[0].x.p:int*=null [line 48, column 18]\n n$0=_fun_init_list::Y::Y(&ty[1]:init_list::Y*,&y:init_list::Y&) [line 48, column 33]\n n$1=*&yref:init_list::Y& [line 48, column 36]\n n$2=_fun_init_list::Y::Y(&ty[2]:init_list::Y*,n$1:init_list::Y&) [line 48, column 36]\n " shape="box"]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_3" [label="3: Destruction(Scope) \n _=*&y:init_list::Y [line 49, column 1]\n n$1=_fun_init_list::Y::~Y(&y:init_list::Y*) injected [line 49, column 1]\n " shape="box"]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_3" -> "list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_2" ;
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_4" [label="4: DeclStmt \n VARIABLE_DECLARED(yref:init_list::Y&); [line 47, column 3]\n *&yref:init_list::Y&=&y [line 47, column 3]\n " shape="box"]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_4" [label="4: DeclStmt \n VARIABLE_DECLARED(ty:init_list::Y[3*24]); [line 48, column 3]\n *&ty[0].z:int=1 [line 48, column 14]\n *&ty[0].x.a:int=2 [line 48, column 18]\n *&ty[0].x.p:int*=null [line 48, column 18]\n n$3=_fun_init_list::Y::Y(&ty[1]:init_list::Y*,&y:init_list::Y&) [line 48, column 33]\n n$4=*&yref:init_list::Y& [line 48, column 36]\n n$5=_fun_init_list::Y::Y(&ty[2]:init_list::Y*,n$4:init_list::Y&) [line 48, column 36]\n " shape="box"]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_4" -> "list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_3" ;
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_5" [label="5: DeclStmt \n VARIABLE_DECLARED(y:init_list::Y); [line 46, column 3]\n n$3=_fun_init_list::Y::Y(&y:init_list::Y*) [line 46, column 5]\n " shape="box"]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_5" [label="5: DeclStmt \n VARIABLE_DECLARED(yref:init_list::Y&); [line 47, column 3]\n *&yref:init_list::Y&=&y [line 47, column 3]\n " shape="box"]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_5" -> "list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_4" ;
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_6" [label="6: DeclStmt \n VARIABLE_DECLARED(ti:int[4*4]); [line 45, column 3]\n *&ti[0]:int=1 [line 45, column 15]\n *&ti[1]:int=2 [line 45, column 15]\n " shape="box"]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_6" [label="6: DeclStmt \n VARIABLE_DECLARED(y:init_list::Y); [line 46, column 3]\n n$6=_fun_init_list::Y::Y(&y:init_list::Y*) [line 46, column 5]\n " shape="box"]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_6" -> "list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_5" ;
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_7" [label="7: DeclStmt \n VARIABLE_DECLARED(ti:int[4*4]); [line 45, column 3]\n *&ti[0]:int=1 [line 45, column 15]\n *&ti[1]:int=2 [line 45, column 15]\n " shape="box"]
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_7" -> "list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_6" ;
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_1" [label="1: Start init_list::record_init\nFormals: \nLocals: c:init_list::C y2:init_list::Y y1:init_list::Y x:init_list::X \n " color=yellow style=filled]
@ -41,11 +45,11 @@ digraph cfg {
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_2" [label="2: Exit init_list::record_init \n " color=yellow style=filled]
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_3" [label="3: Destruction(Scope) \n _=*&c:init_list::C [line 42, column 1]\n n$1=_fun_init_list::C::~C(&c:init_list::C*) injected [line 42, column 1]\n _=*&x:init_list::X [line 42, column 1]\n n$3=_fun_init_list::X::~X(&x:init_list::X*) injected [line 42, column 1]\n " shape="box"]
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_3" [label="3: Destruction(Scope) \n _=*&c:init_list::C [line 42, column 1]\n n$1=_fun_init_list::C::~C(&c:init_list::C*) injected [line 42, column 1]\n _=*&y2:init_list::Y [line 42, column 1]\n n$3=_fun_init_list::Y::~Y(&y2:init_list::Y*) injected [line 42, column 1]\n _=*&y1:init_list::Y [line 42, column 1]\n n$5=_fun_init_list::Y::~Y(&y1:init_list::Y*) injected [line 42, column 1]\n _=*&x:init_list::X [line 42, column 1]\n n$7=_fun_init_list::X::~X(&x:init_list::X*) injected [line 42, column 1]\n " shape="box"]
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_3" -> "record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_2" ;
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_4" [label="4: DeclStmt \n VARIABLE_DECLARED(c:init_list::C); [line 41, column 3]\n n$5=_fun_init_list::C::C(&c:init_list::C*,1:int,2:int,&x:init_list::X&) [line 41, column 5]\n " shape="box"]
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_4" [label="4: DeclStmt \n VARIABLE_DECLARED(c:init_list::C); [line 41, column 3]\n n$9=_fun_init_list::C::C(&c:init_list::C*,1:int,2:int,&x:init_list::X&) [line 41, column 5]\n " shape="box"]
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_4" -> "record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_3" ;
@ -53,7 +57,7 @@ digraph cfg {
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_5" -> "record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_4" ;
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_6" [label="6: DeclStmt \n VARIABLE_DECLARED(y1:init_list::Y); [line 38, column 3]\n *&y1.z:int=1 [line 38, column 7]\n n$6=_fun_init_list::X::X(&y1.x:init_list::X*,&x:init_list::X&) [line 38, column 11]\n " shape="box"]
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_6" [label="6: DeclStmt \n VARIABLE_DECLARED(y1:init_list::Y); [line 38, column 3]\n *&y1.z:int=1 [line 38, column 7]\n n$10=_fun_init_list::X::X(&y1.x:init_list::X*,&x:init_list::X&) [line 38, column 11]\n " shape="box"]
"record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_6" -> "record_init#init_list#9390182661430352809.a0bac2a3cf71c0b7c450ce49d030845f_5" ;
@ -87,11 +91,11 @@ digraph cfg {
"zero_init_record#init_list#7364160241041626579.8baaea62666796dca7b4a7b11bf4f2bb_2" [label="2: Exit init_list::zero_init_record \n " color=yellow style=filled]
"zero_init_record#init_list#7364160241041626579.8baaea62666796dca7b4a7b11bf4f2bb_3" [label="3: Destruction(Scope) \n _=*&c:init_list::C [line 34, column 1]\n n$1=_fun_init_list::C::~C(&c:init_list::C*) injected [line 34, column 1]\n " shape="box"]
"zero_init_record#init_list#7364160241041626579.8baaea62666796dca7b4a7b11bf4f2bb_3" [label="3: Destruction(Scope) \n _=*&c:init_list::C [line 34, column 1]\n n$1=_fun_init_list::C::~C(&c:init_list::C*) injected [line 34, column 1]\n _=*&y:init_list::Y [line 34, column 1]\n n$3=_fun_init_list::Y::~Y(&y:init_list::Y*) injected [line 34, column 1]\n " shape="box"]
"zero_init_record#init_list#7364160241041626579.8baaea62666796dca7b4a7b11bf4f2bb_3" -> "zero_init_record#init_list#7364160241041626579.8baaea62666796dca7b4a7b11bf4f2bb_2" ;
"zero_init_record#init_list#7364160241041626579.8baaea62666796dca7b4a7b11bf4f2bb_4" [label="4: DeclStmt \n VARIABLE_DECLARED(c:init_list::C); [line 33, column 3]\n n$3=_fun_init_list::C::C(&c:init_list::C*) [line 33, column 5]\n " shape="box"]
"zero_init_record#init_list#7364160241041626579.8baaea62666796dca7b4a7b11bf4f2bb_4" [label="4: DeclStmt \n VARIABLE_DECLARED(c:init_list::C); [line 33, column 3]\n n$5=_fun_init_list::C::C(&c:init_list::C*) [line 33, column 5]\n " shape="box"]
"zero_init_record#init_list#7364160241041626579.8baaea62666796dca7b4a7b11bf4f2bb_4" -> "zero_init_record#init_list#7364160241041626579.8baaea62666796dca7b4a7b11bf4f2bb_3" ;

@ -18,37 +18,45 @@ digraph cfg {
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_1" [label="1: Start initialization_c_style\nFormals: \nLocals: z2:Z z:Z[2*8] \n " color=yellow style=filled]
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_1" -> "initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_4" ;
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_1" -> "initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_5" ;
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_2" [label="2: Exit initialization_c_style \n " color=yellow style=filled]
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_3" [label="3: DeclStmt \n VARIABLE_DECLARED(z2:Z); [line 32, column 3]\n n$0=_fun_Z::Z(&z2:Z*) [line 32, column 12]\n " shape="box"]
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_3" [label="3: Destruction(Scope) \n _=*&z2:Z [line 33, column 1]\n n$1=_fun_Z::~Z(&z2:Z*) injected [line 33, column 1]\n " shape="box"]
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_3" -> "initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_2" ;
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_4" [label="4: DeclStmt \n VARIABLE_DECLARED(z:Z[2*8]); [line 31, column 3]\n *&z[0].a:int=1 [line 31, column 20]\n *&z[0].b:int=2 [line 31, column 20]\n *&z[1].a:int=2 [line 31, column 28]\n *&z[1].b:int=3 [line 31, column 28]\n " shape="box"]
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_4" [label="4: DeclStmt \n VARIABLE_DECLARED(z2:Z); [line 32, column 3]\n n$3=_fun_Z::Z(&z2:Z*) [line 32, column 12]\n " shape="box"]
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_4" -> "initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_3" ;
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_5" [label="5: DeclStmt \n VARIABLE_DECLARED(z:Z[2*8]); [line 31, column 3]\n *&z[0].a:int=1 [line 31, column 20]\n *&z[0].b:int=2 [line 31, column 20]\n *&z[1].a:int=2 [line 31, column 28]\n *&z[1].b:int=3 [line 31, column 28]\n " shape="box"]
"initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_5" -> "initialization_c_style#16495589501342328206.0d90448020e72c05f693b9221dac03f8_4" ;
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_1" [label="1: Start initialization_mixed_styles_not_handled_correctly\nFormals: \nLocals: z2:Z z:Z[2*8] old:Z \n " color=yellow style=filled]
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_1" -> "initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_5" ;
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_1" -> "initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_6" ;
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_2" [label="2: Exit initialization_mixed_styles_not_handled_correctly \n " color=yellow style=filled]
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_3" [label="3: DeclStmt \n VARIABLE_DECLARED(z2:Z); [line 40, column 3]\n n$0=_fun_Z::Z(&z2:Z*) [line 40, column 12]\n " shape="box"]
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_3" [label="3: Destruction(Scope) \n _=*&z2:Z [line 41, column 1]\n n$1=_fun_Z::~Z(&z2:Z*) injected [line 41, column 1]\n _=*&old:Z [line 41, column 1]\n n$3=_fun_Z::~Z(&old:Z*) injected [line 41, column 1]\n " shape="box"]
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_3" -> "initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_2" ;
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_4" [label="4: DeclStmt \n VARIABLE_DECLARED(z:Z[2*8]); [line 39, column 3]\n *&z[0].a:int=1 [line 39, column 20]\n *&z[0].b:int=2 [line 39, column 20]\n n$1=_fun_Z::Z(&z[1]:Z*,&old:Z&) [line 39, column 28]\n " shape="box"]
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_4" [label="4: DeclStmt \n VARIABLE_DECLARED(z2:Z); [line 40, column 3]\n n$5=_fun_Z::Z(&z2:Z*) [line 40, column 12]\n " shape="box"]
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_4" -> "initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_3" ;
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_5" [label="5: DeclStmt \n VARIABLE_DECLARED(old:Z); [line 38, column 3]\n n$2=_fun_Z::Z(&old:Z*) [line 38, column 12]\n " shape="box"]
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_5" [label="5: DeclStmt \n VARIABLE_DECLARED(z:Z[2*8]); [line 39, column 3]\n *&z[0].a:int=1 [line 39, column 20]\n *&z[0].b:int=2 [line 39, column 20]\n n$6=_fun_Z::Z(&z[1]:Z*,&old:Z&) [line 39, column 28]\n " shape="box"]
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_5" -> "initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_4" ;
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_6" [label="6: DeclStmt \n VARIABLE_DECLARED(old:Z); [line 38, column 3]\n n$7=_fun_Z::Z(&old:Z*) [line 38, column 12]\n " shape="box"]
"initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_6" -> "initialization_mixed_styles_not_handled_correctly#5603413470418470631.422782850043f1b48105fbbb47efe379_5" ;
"matrix_of_person#2881910427017022824.27f7f148c4911c13b3061cef6fe2673d_1" [label="1: Start matrix_of_person\nFormals: \nLocals: arr:Person[2*4][2*8] 0$?%__sil_tmpSIL_materialize_temp__n$1:Person 0$?%__sil_tmpSIL_materialize_temp__n$2:Person 0$?%__sil_tmpSIL_materialize_temp__n$3:Person 0$?%__sil_tmpSIL_materialize_temp__n$4:Person \n " color=yellow style=filled]

@ -62,7 +62,7 @@ digraph cfg {
"forward<int>#std#5548362574050729124.664bf3a19e8401f31df778b67554bdae_2" [label="2: Exit std::forward<int> \n " color=yellow style=filled]
"forward<int>#std#5548362574050729124.664bf3a19e8401f31df778b67554bdae_3" [label="3: Return Stmt \n n$0=*&__t:int& [line 2313, column 31]\n *&return:int&=n$0 [line 2313, column 5]\n " shape="box"]
"forward<int>#std#5548362574050729124.664bf3a19e8401f31df778b67554bdae_3" [label="3: Return Stmt \n n$0=*&__t:int& [line 2289, column 31]\n *&return:int&=n$0 [line 2289, column 5]\n " shape="box"]
"forward<int>#std#5548362574050729124.664bf3a19e8401f31df778b67554bdae_3" -> "forward<int>#std#5548362574050729124.664bf3a19e8401f31df778b67554bdae_2" ;
@ -73,7 +73,7 @@ digraph cfg {
"forward<int_&>#std#2714018779968350623.5a6c534312c02b38db42a98e7dfe7983_2" [label="2: Exit std::forward<int_&> \n " color=yellow style=filled]
"forward<int_&>#std#2714018779968350623.5a6c534312c02b38db42a98e7dfe7983_3" [label="3: Return Stmt \n n$0=*&__t:int& [line 2313, column 31]\n *&return:int&=n$0 [line 2313, column 5]\n " shape="box"]
"forward<int_&>#std#2714018779968350623.5a6c534312c02b38db42a98e7dfe7983_3" [label="3: Return Stmt \n n$0=*&__t:int& [line 2289, column 31]\n *&return:int&=n$0 [line 2289, column 5]\n " shape="box"]
"forward<int_&>#std#2714018779968350623.5a6c534312c02b38db42a98e7dfe7983_3" -> "forward<int_&>#std#2714018779968350623.5a6c534312c02b38db42a98e7dfe7983_2" ;

@ -4,19 +4,24 @@
* 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 <Foundation/NSObject.h>
#import <string>
std::string stdStringOK(NSString* s) {
const char* s1 = [s UTF8String];
@interface A : NSObject {
}
- (char _Nullable*)toString;
@end
std::string stdStringOK(A* a) {
const char* s1 = [a toString];
if (s1) {
std::string s2 = std::string([s UTF8String]);
std::string s2 = std::string(s1);
return s2;
} else
return "";
}
std::string stdStringBad(NSString* s) {
std::string s2 = std::string([s UTF8String]);
std::string stdStringBad(A* a) {
std::string s2 = std::string([a toString]);
return s2;
}

@ -1 +1 @@
codetoanalyze/objcpp/nullable/Examples.mm, stdStringBad, 1, NULLSAFE_NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereferencing the return of UTF8String,assignment of the nullable value,definition of UTF8String]
codetoanalyze/objcpp/nullable/Examples.mm, stdStringBad, 1, NULLSAFE_NULLABLE_DEREFERENCE, no_bucket, ERROR, [dereferencing the return of toString,assignment of the nullable value,definition of toString]

Loading…
Cancel
Save