diff --git a/.buckconfig b/.buckconfig index b8259b76f..e2316f9a6 100644 --- a/.buckconfig +++ b/.buckconfig @@ -5,8 +5,6 @@ integration_tests = //infer/tests:integration_tests objc = //infer/tests:objc_tests - c = //infer/tests:c_tests - cpp = //infer/tests:cpp_tests objcpp = //infer/tests:objcpp_tests clang = //infer/tests:clang_tests java = //infer/tests/endtoend:java_endtoend_tests diff --git a/Makefile b/Makefile index 5b002f9b5..7ca167588 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,7 @@ include $(ROOT_DIR)/Makefile.config DIRECT_TESTS= TARGETS_TO_TEST= ifeq ($(BUILD_C_ANALYZERS),yes) -TARGETS_TO_TEST += c cpp -DIRECT_TESTS += c_infer_test cpp_infer_test +DIRECT_TESTS += c_infer_test c_frontend_test cpp_infer_test cpp_frontend_test endif ifeq ($(BUILD_JAVA_ANALYZERS),yes) TARGETS_TO_TEST += java @@ -99,9 +98,23 @@ endif ocaml_unit_test: test_this_build $(TEST_BUILD_DIR)/unit/inferunit.byte +frontend_replace: c_frontend_replace cpp_frontend_replace + +c_frontend_replace: + make -C ./infer/tests/codetoanalyze/c/frontend replace + +c_frontend_test: + make -C ./infer/tests/codetoanalyze/c/frontend test + c_infer_test: make -C ./infer/tests/codetoanalyze/c/errors test +cpp_frontend_replace: + make -C ./infer/tests/codetoanalyze/cpp/frontend replace + +cpp_frontend_test: + make -C ./infer/tests/codetoanalyze/cpp/frontend test + cpp_infer_test: make -C ./infer/tests/codetoanalyze/cpp/errors test diff --git a/infer/src/IR/Cfg.re b/infer/src/IR/Cfg.re index b60a9ed79..1acab5e54 100644 --- a/infer/src/IR/Cfg.re +++ b/infer/src/IR/Cfg.re @@ -1286,7 +1286,7 @@ let inline_java_synthetic_methods cfg => { /** Save a cfg into a file */ -let store_cfg_to_file (filename: DB.filename) (save_sources: bool) (cfg: cfg) => { +let store_cfg_to_file save_sources::save_sources=true (filename: DB.filename) (cfg: cfg) => { inline_java_synthetic_methods cfg; if save_sources { save_source_files cfg diff --git a/infer/src/IR/Cfg.rei b/infer/src/IR/Cfg.rei index 825a2f29a..143204f2a 100644 --- a/infer/src/IR/Cfg.rei +++ b/infer/src/IR/Cfg.rei @@ -26,7 +26,7 @@ let load_cfg_from_file: DB.filename => option cfg; /** Save a cfg into a file, and save a copy of the source files if the boolean is true */ -let store_cfg_to_file: DB.filename => bool => cfg => unit; +let store_cfg_to_file: save_sources::bool? => DB.filename => cfg => unit; /** proc description */ diff --git a/infer/src/backend/CommandLineOption.ml b/infer/src/backend/CommandLineOption.ml index a0de4a80c..08b5faf53 100644 --- a/infer/src/backend/CommandLineOption.ml +++ b/infer/src/backend/CommandLineOption.ml @@ -35,6 +35,8 @@ let exes = [ let all_exes = IList.map snd exes +let frontend_exes = [Clang; Java; Llvm] + let current_exe = if !Sys.interactive then Interactive else diff --git a/infer/src/backend/CommandLineOption.mli b/infer/src/backend/CommandLineOption.mli index 741c5974b..d54bf8626 100644 --- a/infer/src/backend/CommandLineOption.mli +++ b/infer/src/backend/CommandLineOption.mli @@ -18,6 +18,8 @@ val current_exe : exe val all_exes : exe list +val frontend_exes: exe list + (** The [mk_*] functions declare command line options, while [parse] parses then according to the declared options. diff --git a/infer/src/backend/config.ml b/infer/src/backend/config.ml index e60e2e73f..72158ab3c 100644 --- a/infer/src/backend/config.ml +++ b/infer/src/backend/config.ml @@ -600,6 +600,11 @@ and bugs_json = ~exes:CLOpt.[Print] ~meta:"file" "Create a file containing a list of issues in JSON format" +and frontend_tests = + CLOpt.mk_bool ~long:"frontend-tests" + ~exes:CLOpt.frontend_exes + "Save filename.ext.test.dot with the cfg in dotty format for frontend tests" + and bugs_tests = CLOpt.mk_option ~long:"issues-tests" ~f:create_outfile ~exes:CLOpt.[Print] @@ -1367,6 +1372,7 @@ and buck_build_args = !buck_build_args and buck_out = !buck_out and bugs_csv = !bugs_csv and bugs_json = !bugs_json +and frontend_tests = !frontend_tests and bugs_tests = !bugs_tests and bugs_txt = !bugs_txt and bugs_xml = !bugs_xml @@ -1492,8 +1498,8 @@ let clang_frontend_do_capture, clang_frontend_do_lint = | `Lint_and_capture -> true, true let clang_frontend_action_string = - String.concat " and " - ((if clang_frontend_do_capture then ["translating"] else []) + String.concat " and " + ((if clang_frontend_do_capture then ["translating"] else []) @ (if clang_frontend_do_lint then ["linting"] else [])) diff --git a/infer/src/backend/config.mli b/infer/src/backend/config.mli index 684f65af0..dce544bab 100644 --- a/infer/src/backend/config.mli +++ b/infer/src/backend/config.mli @@ -193,6 +193,7 @@ val failures_allowed : bool val filtering : bool val flavors : bool val frontend_debug : bool +val frontend_tests : bool val frontend_stats : bool val headers : bool val infer_cache : string option diff --git a/infer/src/backend/dotty.ml b/infer/src/backend/dotty.ml index e428b51a2..ff772bd9d 100644 --- a/infer/src/backend/dotty.ml +++ b/infer/src/backend/dotty.ml @@ -1024,33 +1024,24 @@ let print_icfg fmt cfg = F.fprintf fmt "%a\n" pp_cfgnode node in IList.iter print_node (Cfg.Node.get_all_nodes cfg) -let print_edges fmt edges = - let count = ref 0 in - let print_edge (n1, n2) = - incr count; - F.fprintf fmt "%a -> %a [color=\"red\" label=\"%d\" fontcolor=\"green\"];" pp_cfgnodename n1 pp_cfgnodename n2 !count in - IList.iter print_edge edges - -let print_icfg_dotty cfg (extra_edges : (Cfg.Node.t * Cfg.Node.t) list) = - let chan = - open_out - (DB.filename_to_string - (DB.Results_dir.path_to_filename DB.Results_dir.Abs_source_dir [Config.dotty_output])) in +let write_icfg_dotty_to_file cfg fname = + let chan = open_out fname in let fmt = Format.formatter_of_out_channel chan in (* avoid phabricator thinking this file was generated by substituting substring with %s *) F.fprintf fmt "/* @@%s */@\ndigraph iCFG {@\n" "generated"; print_icfg fmt cfg; - print_edges fmt extra_edges; F.fprintf fmt "}\n"; close_out chan -let store_icfg_to_file filename cfg = - let chan = open_out ((Filename.chop_extension filename)^".dot") in - let fmt = Format.formatter_of_out_channel chan in - F.fprintf fmt "digraph iCFG {\n"; - print_icfg fmt cfg; - F.fprintf fmt "}\n"; - close_out chan +let print_icfg_dotty cfg = + let fname = + if Config.frontend_tests + then + (DB.source_file_to_string !DB.current_source) ^ ".test.dot" + else + DB.filename_to_string + (DB.Results_dir.path_to_filename DB.Results_dir.Abs_source_dir [Config.dotty_output]) in + write_icfg_dotty_to_file cfg fname (********** END of Printing dotty files ***********) diff --git a/infer/src/backend/dotty.mli b/infer/src/backend/dotty.mli index 23db8ea60..1094cd4b8 100644 --- a/infer/src/backend/dotty.mli +++ b/infer/src/backend/dotty.mli @@ -33,11 +33,8 @@ val pp_proplist_parsed2dotty_file : string -> Prop.normal Prop.t list -> unit (** {2 Contol-Flow Graph} *) -(** Print the cfg with extra edges *) -val print_icfg_dotty : Cfg.cfg -> ((Cfg.Node.t * Cfg.Node.t) list) -> unit - -(** [store_icfg_to_file f cfg] saves the dotty representation of the control flow graph [cfg] into the file [f] *) -val store_icfg_to_file: string -> Cfg.cfg -> unit +(** Print the cfg *) +val print_icfg_dotty : Cfg.cfg -> unit (** {2 Specs} *) val reset_dotty_spec_counter : unit -> unit diff --git a/infer/src/clang/cFrontend.ml b/infer/src/clang/cFrontend.ml index 5bd548e0c..809af4807 100644 --- a/infer/src/clang/cFrontend.ml +++ b/infer/src/clang/cFrontend.ml @@ -71,7 +71,7 @@ let do_source_file source_file ast = let cfg_file = DB.source_dir_get_internal_file source_dir ".cfg" in let cg_file = DB.source_dir_get_internal_file source_dir ".cg" in Cg.store_to_file cg_file call_graph; - Cfg.store_cfg_to_file cfg_file true cfg; + Cfg.store_cfg_to_file cfg_file cfg; (*Logging.out "Tenv %a@." Sil.pp_tenv tenv;*) (* Printing.print_tenv tenv; *) (*Printing.print_procedures cfg; *) @@ -79,6 +79,8 @@ let do_source_file source_file ast = Tenv.store_to_file tenv_file tenv; if Config.stats_mode then Cfg.check_cfg_connectedness cfg; if Config.stats_mode - || Config.debug_mode || Config.testing_mode then - (Dotty.print_icfg_dotty cfg []; + || Config.debug_mode + || Config.testing_mode + || Config.frontend_tests then + (Dotty.print_icfg_dotty cfg; Cg.save_call_graph_dotty None Specs.get_specs call_graph) diff --git a/infer/src/java/QUESTIONS b/infer/src/java/QUESTIONS deleted file mode 100644 index 52b712329..000000000 --- a/infer/src/java/QUESTIONS +++ /dev/null @@ -1,5 +0,0 @@ - -- It seems that we are never calling print_icfg_dotty with the second -argument: "extra edges" - -- What does the location corresponds to for a procdesc created for an external method invocation ? diff --git a/infer/src/java/jMain.ml b/infer/src/java/jMain.ml index 2c37839a4..e0b785b85 100644 --- a/infer/src/java/jMain.ml +++ b/infer/src/java/jMain.ml @@ -49,10 +49,10 @@ let store_icfg tenv cg cfg = let cg_file = DB.source_dir_get_internal_file source_dir ".cg" in if Config.create_harness then Harness.create_harness cfg cg tenv; Cg.store_to_file cg_file cg; - Cfg.store_cfg_to_file cfg_file true cfg; - if Config.debug_mode then + Cfg.store_cfg_to_file cfg_file cfg; + if Config.debug_mode || Config.frontend_tests then begin - Dotty.print_icfg_dotty cfg []; + Dotty.print_icfg_dotty cfg; Cg.save_call_graph_dotty None Specs.get_specs cg end end diff --git a/infer/src/llvm/lMain.ml b/infer/src/llvm/lMain.ml index 24aa97480..00a11acd2 100644 --- a/infer/src/llvm/lMain.ml +++ b/infer/src/llvm/lMain.ml @@ -36,10 +36,10 @@ let store_icfg cg cfg = let cg_file = get_internal_file ".cg" in let cfg_file = get_internal_file ".cfg" in Cg.store_to_file cg_file cg; - Cfg.store_cfg_to_file cfg_file true cfg; - if Config.debug_mode then + Cfg.store_cfg_to_file cfg_file cfg; + if Config.debug_mode || Config.frontend_tests then begin - Dotty.print_icfg_dotty cfg []; + Dotty.print_icfg_dotty cfg; Cg.save_call_graph_dotty None Specs.get_specs cg end diff --git a/infer/tests/BUCK b/infer/tests/BUCK index 22ccee2f8..e9e482c06 100644 --- a/infer/tests/BUCK +++ b/infer/tests/BUCK @@ -1,17 +1,3 @@ -java_test( - name='c_tests', - deps=[ - '//infer/tests/frontend:c_frontend_tests', - ], -) - -java_test( - name='cpp_tests', - deps=[ - '//infer/tests/frontend:cpp_frontend_tests', - ], -) - java_test( name='objc_tests', deps=[ @@ -31,9 +17,7 @@ java_test( java_test( name='clang_tests', deps=[ - '//infer/tests:c_tests', '//infer/tests:objc_tests', - '//infer/tests:cpp_tests', '//infer/tests:objcpp_tests', ], ) diff --git a/infer/tests/codetoanalyze/Makefile.frontend b/infer/tests/codetoanalyze/Makefile.frontend new file mode 100644 index 000000000..6352519dd --- /dev/null +++ b/infer/tests/codetoanalyze/Makefile.frontend @@ -0,0 +1,26 @@ +# Copyright (c) 2016 - present Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD style license found in the +# LICENSE file in the root directory of this source tree. An additional grant +# of patent rights can be found in the PATENTS file in the same directory. + +ROOT_DIR = ../../../../.. +include $(ROOT_DIR)/Makefile.config + +default: compile + +test: capture + for file in $(FILES) ; do \ + diff -u $$file.dot $$file.test.dot ; \ + done + make clean + +replace: capture + for file in $(FILES) ; do \ + mv $$file.test.dot $$file.dot ; \ + done + make clean + +clean: + rm -rf infer-out *.o */*.test.dot diff --git a/infer/tests/codetoanalyze/c/frontend/Makefile b/infer/tests/codetoanalyze/c/frontend/Makefile new file mode 100644 index 000000000..b466c3c76 --- /dev/null +++ b/infer/tests/codetoanalyze/c/frontend/Makefile @@ -0,0 +1,20 @@ +# Copyright (c) 2016 - present Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD style license found in the +# LICENSE file in the root directory of this source tree. An additional grant +# of patent rights can be found in the PATENTS file in the same directory. + +include ../../Makefile.frontend + +OPTIONS = -c + +FILES = \ + */*.c \ + */*.cpp \ + +compile: + clang $(OPTIONS) $(FILES) + +capture: + infer -a capture --frontend-tests --cxx -- clang $(OPTIONS) $(FILES) diff --git a/infer/tests/codetoanalyze/c/frontend/assertions/assert_example.c.dot b/infer/tests/codetoanalyze/c/frontend/assertions/assert_example.c.dot index b28d3ffc6..098334ab2 100644 --- a/infer/tests/codetoanalyze/c/frontend/assertions/assert_example.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/assertions/assert_example.c.dot @@ -1,42 +1,64 @@ +/* @generated */ digraph iCFG { -10 [label="10: ConditinalStmt Branch \n DECLARE_LOCALS(&SIL_temp_conditional___4); [line -1]\n *&SIL_temp_conditional___4:void =0 [line -1]\n " shape="box"] +15 [label="15: ConditinalStmt Branch \n *&0$?%__sil_tmpSIL_temp_conditional___n$2:void =0 [line 17]\n " shape="box"] - 10 -> 4 ; -9 [label="9: Prune (true branch) \n PRUNE(1, true); [line -1]\n APPLY_ABSTRACTION; [line -1]\n " shape="invhouse"] + 15 -> 4 ; +14 [label="14: ConditinalStmt Branch \n *&0$?%__sil_tmpSIL_temp_conditional___n$2:void =-1 [line 17]\n " shape="box"] - 9 -> 8 ; -8 [label="8: + \n DECLARE_LOCALS(&SIL_temp_conditional___4); [line -1]\n *&SIL_temp_conditional___4:void =-1 [line -1]\n " ] + 14 -> 4 ; +13 [label="13: Prune (true branch) \n PRUNE(0, true); [line 17]\n " shape="invhouse"] - 8 -> 9 ; -7 [label="7: Prune (false branch) \n PRUNE(!n$3, false); [line -1]\n REMOVE_TEMPS(n$2,n$3); [line -1]\n " shape="invhouse"] + 13 -> 14 ; +12 [label="12: Prune (false branch) \n n$5=*&0$?%__sil_tmpSIL_temp_conditional___n$3:int [line 17]\n PRUNE((n$5 == 0), false); [line 17]\n " shape="invhouse"] - 7 -> 10 ; -6 [label="6: Prune (true branch) \n PRUNE(n$3, true); [line -1]\n REMOVE_TEMPS(n$2,n$3); [line -1]\n APPLY_ABSTRACTION; [line -1]\n " shape="invhouse"] + 12 -> 15 ; +11 [label="11: Prune (true branch) \n n$5=*&0$?%__sil_tmpSIL_temp_conditional___n$3:int [line 17]\n PRUNE((n$5 != 0), true); [line 17]\n " shape="invhouse"] + 11 -> 13 ; +10 [label="10: ConditinalStmt Branch \n *&0$?%__sil_tmpSIL_temp_conditional___n$3:int =1 [line 17]\n " shape="box"] + + + 10 -> 5 ; +9 [label="9: ConditinalStmt Branch \n *&0$?%__sil_tmpSIL_temp_conditional___n$3:int =0 [line 17]\n " shape="box"] + + + 9 -> 5 ; +8 [label="8: Prune (false branch) \n PRUNE(((n$4 != 0) == 0), false); [line 17]\n " shape="invhouse"] + + + 8 -> 10 ; +7 [label="7: Prune (true branch) \n PRUNE(((n$4 != 0) != 0), true); [line 17]\n " shape="invhouse"] + + + 7 -> 9 ; +6 [label="6: BinaryOperatorStmt: NE \n n$4=*&activeq:struct MyPoint * [line 17]\n " shape="box"] + + + 6 -> 7 ; 6 -> 8 ; -5 [label="5: Call _fun_infer__builtin_expect \n n$2=*&activeq:struct MyPoint * [line 8]\n n$3=_fun_infer__builtin_expect(!(n$2 != 0):long ,0:long ) [line -1]\n " shape="box"] +5 [label="5: + \n " ] - 5 -> 6 ; - 5 -> 7 ; + 5 -> 11 ; + 5 -> 12 ; 4 [label="4: + \n " ] 4 -> 3 ; -3 [label="3: Return Stmt \n n$0=*&activeq:struct MyPoint * [line 9]\n n$1=*n$0.x:int [line 9]\n *&return:int =n$1 [line 9]\n REMOVE_TEMPS(n$0,n$1); [line 9]\n NULLIFY(&activeq,false); [line 9]\n APPLY_ABSTRACTION; [line 9]\n " shape="box"] +3 [label="3: Return Stmt \n n$0=*&activeq:struct MyPoint * [line 18]\n n$1=*n$0.x:int [line 18]\n *&return:int =n$1 [line 18]\n " shape="box"] 3 -> 2 ; -2 [label="2: Exit test \n " color=yellow style=filled] +2 [label="2: Exit test_assert \n " color=yellow style=filled] -1 [label="1: Start test\nFormals: activeq:struct MyPoint *\nLocals: \n DECLARE_LOCALS(&return); [line 7]\n " color=yellow style=filled] +1 [label="1: Start test_assert\nFormals: activeq:struct MyPoint *\nLocals: 0$?%__sil_tmpSIL_temp_conditional___n$2:void 0$?%__sil_tmpSIL_temp_conditional___n$3:int \n DECLARE_LOCALS(&return,&0$?%__sil_tmpSIL_temp_conditional___n$2,&0$?%__sil_tmpSIL_temp_conditional___n$3); [line 16]\n " color=yellow style=filled] - 1 -> 5 ; + 1 -> 6 ; } diff --git a/infer/tests/codetoanalyze/c/frontend/enumeration/enum_bitmask.c b/infer/tests/codetoanalyze/c/frontend/enumeration/enum_bitmask.c index b938aafe1..080bc698f 100644 --- a/infer/tests/codetoanalyze/c/frontend/enumeration/enum_bitmask.c +++ b/infer/tests/codetoanalyze/c/frontend/enumeration/enum_bitmask.c @@ -13,6 +13,6 @@ typedef enum MyOption { }; int main() { - MyOption option1 = MyOption1; - MyOption option2 = MyOption2; + enum MyOption option1 = MyOption1; + enum MyOption option2 = MyOption2; } diff --git a/infer/tests/codetoanalyze/c/frontend/nestedoperators/union.c.dot b/infer/tests/codetoanalyze/c/frontend/nestedoperators/union.c.dot index 3d856264e..249dc6b89 100644 --- a/infer/tests/codetoanalyze/c/frontend/nestedoperators/union.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/nestedoperators/union.c.dot @@ -1,6 +1,6 @@ /* @generated */ digraph iCFG { -7 [label="7: BinaryOperatorStmt: Assign \n n$3=*&#GB$x:struct anonymous_struct_infer_tests_codetoanalyze_c_frontend_nestedoperators_union.c:12:1 * [line 32]\n *n$3.a:int =1 [line 32]\n " shape="box"] +7 [label="7: BinaryOperatorStmt: Assign \n n$3=*&#GB$x:struct anonymous_struct_nestedoperators_union.c:12:1 * [line 32]\n *n$3.a:int =1 [line 32]\n " shape="box"] 7 -> 6 ; @@ -12,7 +12,7 @@ digraph iCFG { 5 -> 4 ; -4 [label="4: BinaryOperatorStmt: Assign \n n$0=*&#GB$x:struct anonymous_struct_infer_tests_codetoanalyze_c_frontend_nestedoperators_union.c:12:1 * [line 36]\n n$1=*n$0.b:int [line 36]\n *&#GB$y.g.w:int =n$1 [line 36]\n " shape="box"] +4 [label="4: BinaryOperatorStmt: Assign \n n$0=*&#GB$x:struct anonymous_struct_nestedoperators_union.c:12:1 * [line 36]\n n$1=*n$0.b:int [line 36]\n *&#GB$y.g.w:int =n$1 [line 36]\n " shape="box"] 4 -> 3 ; diff --git a/infer/tests/codetoanalyze/c/frontend/nestedoperators/union.cpp.dot b/infer/tests/codetoanalyze/c/frontend/nestedoperators/union.cpp.dot index 843aab37d..d3f3710a6 100644 --- a/infer/tests/codetoanalyze/c/frontend/nestedoperators/union.cpp.dot +++ b/infer/tests/codetoanalyze/c/frontend/nestedoperators/union.cpp.dot @@ -1,6 +1,6 @@ /* @generated */ digraph iCFG { -9 [label="9: BinaryOperatorStmt: Assign \n n$3=*&#GB$x:class anonymous_struct_infer_tests_codetoanalyze_c_frontend_nestedoperators_union.cpp:12:1 * [line 32]\n *n$3.a:int =1 [line 32]\n " shape="box"] +9 [label="9: BinaryOperatorStmt: Assign \n n$3=*&#GB$x:class anonymous_struct_nestedoperators_union.cpp:12:1 * [line 32]\n *n$3.a:int =1 [line 32]\n " shape="box"] 9 -> 8 ; @@ -12,7 +12,7 @@ digraph iCFG { 7 -> 6 ; -6 [label="6: BinaryOperatorStmt: Assign \n n$0=*&#GB$x:class anonymous_struct_infer_tests_codetoanalyze_c_frontend_nestedoperators_union.cpp:12:1 * [line 36]\n n$1=*n$0.b:int [line 36]\n *&#GB$y.g.w:int =n$1 [line 36]\n " shape="box"] +6 [label="6: BinaryOperatorStmt: Assign \n n$0=*&#GB$x:class anonymous_struct_nestedoperators_union.cpp:12:1 * [line 36]\n n$1=*n$0.b:int [line 36]\n *&#GB$y.g.w:int =n$1 [line 36]\n " shape="box"] 6 -> 5 ; @@ -27,10 +27,10 @@ digraph iCFG { 3 -> 9 ; -2 [label="2: Exit anonymous_union_infer_tests_codetoanalyze_c_frontend_nestedoperators_union.cpp:17:1_ \n " color=yellow style=filled] +2 [label="2: Exit anonymous_union_nestedoperators_union.cpp:17:1_ \n " color=yellow style=filled] -1 [label="1: Start anonymous_union_infer_tests_codetoanalyze_c_frontend_nestedoperators_union.cpp:17:1_\nFormals: this:class anonymous_union_infer_tests_codetoanalyze_c_frontend_nestedoperators_union.cpp:17:1 *\nLocals: \n DECLARE_LOCALS(&return); [line 17]\n " color=yellow style=filled] +1 [label="1: Start anonymous_union_nestedoperators_union.cpp:17:1_\nFormals: this:class anonymous_union_nestedoperators_union.cpp:17:1 *\nLocals: \n DECLARE_LOCALS(&return); [line 17]\n " color=yellow style=filled] 1 -> 2 ; diff --git a/infer/tests/codetoanalyze/c/frontend/unusual_exps/generic_exp.c b/infer/tests/codetoanalyze/c/frontend/unusual_exps/generic_exp.c index 80f830052..e40b85faf 100644 --- a/infer/tests/codetoanalyze/c/frontend/unusual_exps/generic_exp.c +++ b/infer/tests/codetoanalyze/c/frontend/unusual_exps/generic_exp.c @@ -9,8 +9,9 @@ #define test(x) _Generic((x), _Bool : 1, char : 2, int : 3, default : 4) -int test_typename(void) { +void test_typename(void) { char s; int y; int x = test(s); int z = test(y); +} diff --git a/infer/tests/codetoanalyze/cpp/frontend/Makefile b/infer/tests/codetoanalyze/cpp/frontend/Makefile new file mode 100644 index 000000000..d5b480556 --- /dev/null +++ b/infer/tests/codetoanalyze/cpp/frontend/Makefile @@ -0,0 +1,19 @@ +# Copyright (c) 2016 - present Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD style license found in the +# LICENSE file in the root directory of this source tree. An additional grant +# of patent rights can be found in the PATENTS file in the same directory. + +include ../../Makefile.frontend + +OPTIONS = -x c++ -std=c++11 -isystem$(MODELS_DIR)/cpp/include -isystem$(CLANG_INCLUDES)/c++/v1/ -c + +FILES = \ + */*.cpp \ + +compile: + clang $(OPTIONS) $(FILES) + +capture: + infer -a capture --frontend-tests --cxx --headers -- clang $(OPTIONS) $(FILES) diff --git a/infer/tests/codetoanalyze/cpp/frontend/constructors/std_init_list.cpp b/infer/tests/codetoanalyze/cpp/frontend/constructors/std_init_list.cpp index 777c38183..44834a87c 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/constructors/std_init_list.cpp +++ b/infer/tests/codetoanalyze/cpp/frontend/constructors/std_init_list.cpp @@ -13,7 +13,7 @@ class X { public: X(std::initializer_list list) { for (auto i = list.begin(); i != list.end(); i++) { - sum = sum + i; + sum = sum + *i; } } diff --git a/infer/tests/codetoanalyze/cpp/frontend/constructors/std_init_list.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/constructors/std_init_list.cpp.dot index fceb741e3..85fa00ec2 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/constructors/std_init_list.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/constructors/std_init_list.cpp.dot @@ -1,46 +1,72 @@ /* @generated */ digraph iCFG { -11 [label="11: DeclStmt \n *&0$?%__sil_tmpSIL_materialize_temp__n$0[0]:int =1 [line 24]\n *&0$?%__sil_tmpSIL_materialize_temp__n$0[1]:int =2 [line 24]\n *&0$?%__sil_tmpSIL_materialize_temp__n$0[2]:int =3 [line 24]\n *&0$?%__sil_tmpSIL_materialize_temp__n$0[3]:int =4 [line 24]\n *&0$?%__sil_tmpSIL_materialize_temp__n$0[4]:int =5 [line 24]\n n$1=_fun___infer_skip_function(&0$?%__sil_tmpSIL_materialize_temp__n$0:int [5]) [line 24]\n _fun_X_X(&x:class X *,n$1:class std::initializer_list ) [line 24]\n " shape="box"] +18 [label="18: DeclStmt \n *&0$?%__sil_tmpSIL_materialize_temp__n$0[0]:int =1 [line 24]\n *&0$?%__sil_tmpSIL_materialize_temp__n$0[1]:int =2 [line 24]\n *&0$?%__sil_tmpSIL_materialize_temp__n$0[2]:int =3 [line 24]\n *&0$?%__sil_tmpSIL_materialize_temp__n$0[3]:int =4 [line 24]\n *&0$?%__sil_tmpSIL_materialize_temp__n$0[4]:int =5 [line 24]\n n$1=_fun___infer_skip_function(&0$?%__sil_tmpSIL_materialize_temp__n$0:int [5]) [line 24]\n _fun_X_X(&x:class X *,n$1:class std::initializer_list ) [line 24]\n " shape="box"] - 11 -> 10 ; -10 [label="10: Exit main \n " color=yellow style=filled] + 18 -> 17 ; +17 [label="17: Exit main \n " color=yellow style=filled] -9 [label="9: Start main\nFormals: \nLocals: x:class X 0$?%__sil_tmpSIL_materialize_temp__n$0:int [5] \n DECLARE_LOCALS(&return,&x,&0$?%__sil_tmpSIL_materialize_temp__n$0); [line 24]\n " color=yellow style=filled] +16 [label="16: Start main\nFormals: \nLocals: x:class X 0$?%__sil_tmpSIL_materialize_temp__n$0:int [5] \n DECLARE_LOCALS(&return,&x,&0$?%__sil_tmpSIL_materialize_temp__n$0); [line 24]\n " color=yellow style=filled] - 9 -> 11 ; -8 [label="8: Prune (false branch) \n PRUNE(((n$4 != n$7) == 0), false); [line 15]\n " shape="invhouse"] + 16 -> 18 ; +15 [label="15: BinaryOperatorStmt: Assign \n n$8=*&this:class X * [line 16]\n n$9=*&this:class X * [line 16]\n n$10=*n$9.sum:int [line 16]\n n$11=*&i:int * [line 16]\n n$12=*n$11:int [line 16]\n *n$8.sum:int =(n$10 + n$12) [line 16]\n " shape="box"] - 8 -> 2 ; -7 [label="7: Prune (true branch) \n PRUNE(((n$4 != n$7) != 0), true); [line 15]\n " shape="invhouse"] + 15 -> 11 ; +14 [label="14: Prune (false branch) \n PRUNE(((n$4 != n$7) == 0), false); [line 15]\n " shape="invhouse"] - 7 -> 5 ; -6 [label="6: BinaryOperatorStmt: NE \n n$4=*&i:int * [line 15]\n n$5=*&list:class std::initializer_list & [line 15]\n _=*n$5:class std::initializer_list [line 15]\n n$7=_fun_std::initializer_list_end(n$5:class std::initializer_list &) [line 15]\n " shape="box"] + 14 -> 8 ; +13 [label="13: Prune (true branch) \n PRUNE(((n$4 != n$7) != 0), true); [line 15]\n " shape="invhouse"] - 6 -> 7 ; - 6 -> 8 ; -5 [label="5: UnaryOperator \n n$3=*&i:int * [line 15]\n *&i:int *=(n$3 + 1) [line 15]\n " shape="box"] + 13 -> 15 ; +12 [label="12: BinaryOperatorStmt: NE \n n$4=*&i:int * [line 15]\n n$5=*&list:class std::initializer_list & [line 15]\n _=*n$5:class std::initializer_list [line 15]\n n$7=_fun_std::initializer_list_end(n$5:class std::initializer_list &) [line 15]\n " shape="box"] - 5 -> 3 ; -4 [label="4: DeclStmt \n n$0=*&list:class std::initializer_list & [line 15]\n _=*n$0:class std::initializer_list [line 15]\n n$2=_fun_std::initializer_list_begin(n$0:class std::initializer_list &) [line 15]\n *&i:int *=n$2 [line 15]\n " shape="box"] + 12 -> 13 ; + 12 -> 14 ; +11 [label="11: UnaryOperator \n n$3=*&i:int * [line 15]\n *&i:int *=(n$3 + 1) [line 15]\n " shape="box"] - 4 -> 3 ; -3 [label="3: + \n " ] + 11 -> 9 ; +10 [label="10: DeclStmt \n n$0=*&list:class std::initializer_list & [line 15]\n _=*n$0:class std::initializer_list [line 15]\n n$2=_fun_std::initializer_list_begin(n$0:class std::initializer_list &) [line 15]\n *&i:int *=n$2 [line 15]\n " shape="box"] - 3 -> 6 ; -2 [label="2: Exit X_X \n " color=yellow style=filled] + 10 -> 9 ; +9 [label="9: + \n " ] -1 [label="1: Start X_X\nFormals: this:class X * list:class std::initializer_list &\nLocals: i:int * \n DECLARE_LOCALS(&return,&i); [line 14]\n " color=yellow style=filled] + 9 -> 12 ; +8 [label="8: Exit X_X \n " color=yellow style=filled] - 1 -> 4 ; +7 [label="7: Start X_X\nFormals: this:class X * list:class std::initializer_list &\nLocals: i:int * \n DECLARE_LOCALS(&return,&i); [line 14]\n " color=yellow style=filled] + + + 7 -> 10 ; +6 [label="6: Return Stmt \n n$0=*&this:class std::initializer_list * [line 93]\n n$1=*n$0.__begin_:int * [line 93]\n n$2=*&this:class std::initializer_list * [line 93]\n n$3=*n$2.__size_:unsigned long [line 93]\n *&return:int *=(n$1 + n$3) [line 93]\n " shape="box"] + + + 6 -> 5 ; +5 [label="5: Exit std::initializer_list_end \n " color=yellow style=filled] + + +4 [label="4: Start std::initializer_list_end\nFormals: this:class std::initializer_list *\nLocals: \n DECLARE_LOCALS(&return); [line 91]\n " color=yellow style=filled] + + + 4 -> 6 ; +3 [label="3: Return Stmt \n n$0=*&this:class std::initializer_list * [line 89]\n n$1=*n$0.__begin_:int * [line 89]\n *&return:int *=n$1 [line 89]\n " shape="box"] + + + 3 -> 2 ; +2 [label="2: Exit std::initializer_list_begin \n " color=yellow style=filled] + + +1 [label="1: Start std::initializer_list_begin\nFormals: this:class std::initializer_list *\nLocals: \n DECLARE_LOCALS(&return); [line 87]\n " color=yellow style=filled] + + + 1 -> 3 ; } diff --git a/infer/tests/codetoanalyze/cpp/frontend/lambda/lambda1.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/lambda/lambda1.cpp.dot new file mode 100644 index 000000000..d7981851d --- /dev/null +++ b/infer/tests/codetoanalyze/cpp/frontend/lambda/lambda1.cpp.dot @@ -0,0 +1,128 @@ +/* @generated */ +digraph iCFG { +34 [label="34: DeclStmt \n *&0$?%__sil_tmpSIL_materialize_temp__n$1:class fooOK::lambda_lambda_lambda1.cpp:26:12 =(_fun_fooOK::lambda_lambda_lambda1.cpp:26:12_operator()) [line 26]\n _fun_fooOK::lambda_lambda_lambda1.cpp:26:12_(&y:class fooOK::lambda_lambda_lambda1.cpp:26:12 *,&0$?%__sil_tmpSIL_materialize_temp__n$1:class fooOK::lambda_lambda_lambda1.cpp:26:12 &) [line 26]\n " shape="box"] + + + 34 -> 31 ; +33 [label="33: Exit fooOK::lambda_lambda_lambda1.cpp:26:12_ \n " color=yellow style=filled] + + +32 [label="32: Start fooOK::lambda_lambda_lambda1.cpp:26:12_\nFormals: this:class fooOK::lambda_lambda_lambda1.cpp:26:12 * __param_0:class fooOK::lambda_lambda_lambda1.cpp:26:12 &\nLocals: \n DECLARE_LOCALS(&return); [line 26]\n " color=yellow style=filled] + + + 32 -> 33 ; +31 [label="31: Return Stmt \n n$0=_fun_fooOK::lambda_lambda_lambda1.cpp:26:12_operator()(&y:class fooOK::lambda_lambda_lambda1.cpp:26:12 &,3:int ) [line 27]\n *&return:int =(5 / (4 - n$0)) [line 27]\n " shape="box"] + + + 31 -> 27 ; +30 [label="30: Return Stmt \n n$0=*&i:int [line 26]\n *&i:int =(n$0 + 1) [line 26]\n *&return:int =n$0 [line 26]\n " shape="box"] + + + 30 -> 29 ; +29 [label="29: Exit fooOK::lambda_lambda_lambda1.cpp:26:12_operator() \n " color=yellow style=filled] + + +28 [label="28: Start fooOK::lambda_lambda_lambda1.cpp:26:12_operator()\nFormals: this:class fooOK::lambda_lambda_lambda1.cpp:26:12 * i:int \nLocals: \n DECLARE_LOCALS(&return); [line 26]\n " color=yellow style=filled] + + + 28 -> 30 ; +27 [label="27: Exit fooOK \n " color=yellow style=filled] + + +26 [label="26: Start fooOK\nFormals: \nLocals: y:class fooOK::lambda_lambda_lambda1.cpp:26:12 0$?%__sil_tmpSIL_materialize_temp__n$1:class fooOK::lambda_lambda_lambda1.cpp:26:12 \n DECLARE_LOCALS(&return,&y,&0$?%__sil_tmpSIL_materialize_temp__n$1); [line 24]\n " color=yellow style=filled] + + + 26 -> 34 ; +25 [label="25: DeclStmt \n *&0$?%__sil_tmpSIL_materialize_temp__n$2:class foo::lambda_lambda_lambda1.cpp:19:17 =(_fun_foo::lambda_lambda_lambda1.cpp:19:17_operator()) [line 19]\n _fun_foo::lambda_lambda_lambda1.cpp:19:17_(&unused:class foo::lambda_lambda_lambda1.cpp:19:17 *,&0$?%__sil_tmpSIL_materialize_temp__n$2:class foo::lambda_lambda_lambda1.cpp:19:17 &) [line 19]\n " shape="box"] + + + 25 -> 19 ; +24 [label="24: Return Stmt \n *&return:int =(1 / 0) [line 19]\n " shape="box"] + + + 24 -> 23 ; +23 [label="23: Exit foo::lambda_lambda_lambda1.cpp:19:17_operator() \n " color=yellow style=filled] + + +22 [label="22: Start foo::lambda_lambda_lambda1.cpp:19:17_operator()\nFormals: this:class foo::lambda_lambda_lambda1.cpp:19:17 *\nLocals: \n DECLARE_LOCALS(&return); [line 19]\n " color=yellow style=filled] + + + 22 -> 24 ; +21 [label="21: Exit foo::lambda_lambda_lambda1.cpp:19:17_ \n " color=yellow style=filled] + + +20 [label="20: Start foo::lambda_lambda_lambda1.cpp:19:17_\nFormals: this:class foo::lambda_lambda_lambda1.cpp:19:17 * __param_0:class foo::lambda_lambda_lambda1.cpp:19:17 &\nLocals: \n DECLARE_LOCALS(&return); [line 19]\n " color=yellow style=filled] + + + 20 -> 21 ; +19 [label="19: DeclStmt \n *&0$?%__sil_tmpSIL_materialize_temp__n$1:class foo::lambda_lambda_lambda1.cpp:20:12 =(_fun_foo::lambda_lambda_lambda1.cpp:20:12_operator()) [line 20]\n _fun_foo::lambda_lambda_lambda1.cpp:20:12_(&y:class foo::lambda_lambda_lambda1.cpp:20:12 *,&0$?%__sil_tmpSIL_materialize_temp__n$1:class foo::lambda_lambda_lambda1.cpp:20:12 &) [line 20]\n " shape="box"] + + + 19 -> 16 ; +18 [label="18: Exit foo::lambda_lambda_lambda1.cpp:20:12_ \n " color=yellow style=filled] + + +17 [label="17: Start foo::lambda_lambda_lambda1.cpp:20:12_\nFormals: this:class foo::lambda_lambda_lambda1.cpp:20:12 * __param_0:class foo::lambda_lambda_lambda1.cpp:20:12 &\nLocals: \n DECLARE_LOCALS(&return); [line 20]\n " color=yellow style=filled] + + + 17 -> 18 ; +16 [label="16: Return Stmt \n n$0=_fun_foo::lambda_lambda_lambda1.cpp:20:12_operator()(&y:class foo::lambda_lambda_lambda1.cpp:20:12 &,3:int ) [line 21]\n *&return:int =(5 / (4 - n$0)) [line 21]\n " shape="box"] + + + 16 -> 12 ; +15 [label="15: Return Stmt \n n$0=*&i:int [line 20]\n *&i:int =(n$0 + 1) [line 20]\n n$1=*&i:int [line 20]\n *&return:int =n$1 [line 20]\n " shape="box"] + + + 15 -> 14 ; +14 [label="14: Exit foo::lambda_lambda_lambda1.cpp:20:12_operator() \n " color=yellow style=filled] + + +13 [label="13: Start foo::lambda_lambda_lambda1.cpp:20:12_operator()\nFormals: this:class foo::lambda_lambda_lambda1.cpp:20:12 * i:int \nLocals: \n DECLARE_LOCALS(&return); [line 20]\n " color=yellow style=filled] + + + 13 -> 15 ; +12 [label="12: Exit foo \n " color=yellow style=filled] + + +11 [label="11: Start foo\nFormals: \nLocals: y:class foo::lambda_lambda_lambda1.cpp:20:12 0$?%__sil_tmpSIL_materialize_temp__n$1:class foo::lambda_lambda_lambda1.cpp:20:12 unused:class foo::lambda_lambda_lambda1.cpp:19:17 0$?%__sil_tmpSIL_materialize_temp__n$2:class foo::lambda_lambda_lambda1.cpp:19:17 \n DECLARE_LOCALS(&return,&y,&0$?%__sil_tmpSIL_materialize_temp__n$1,&unused,&0$?%__sil_tmpSIL_materialize_temp__n$2); [line 18]\n " color=yellow style=filled] + + + 11 -> 25 ; +10 [label="10: DeclStmt \n *&0$?%__sil_tmpSIL_materialize_temp__n$1:class bar::lambda_lambda_lambda1.cpp:11:15 =(_fun_bar::lambda_lambda_lambda1.cpp:11:15_operator()) [line 11]\n _fun_bar::lambda_lambda_lambda1.cpp:11:15_(&func:class bar::lambda_lambda_lambda1.cpp:11:15 *,&0$?%__sil_tmpSIL_materialize_temp__n$1:class bar::lambda_lambda_lambda1.cpp:11:15 &) [line 11]\n " shape="box"] + + + 10 -> 7 ; +9 [label="9: Exit bar::lambda_lambda_lambda1.cpp:11:15_ \n " color=yellow style=filled] + + +8 [label="8: Start bar::lambda_lambda_lambda1.cpp:11:15_\nFormals: this:class bar::lambda_lambda_lambda1.cpp:11:15 * __param_0:class bar::lambda_lambda_lambda1.cpp:11:15 &\nLocals: \n DECLARE_LOCALS(&return); [line 11]\n " color=yellow style=filled] + + + 8 -> 9 ; +7 [label="7: Return Stmt \n n$0=_fun_bar::lambda_lambda_lambda1.cpp:11:15_operator()(&func:class bar::lambda_lambda_lambda1.cpp:11:15 &) [line 15]\n *&return:int =(7 / n$0) [line 15]\n " shape="box"] + + + 7 -> 2 ; +6 [label="6: DeclStmt \n *&i:int =0 [line 12]\n " shape="box"] + + + 6 -> 5 ; +5 [label="5: Return Stmt \n n$0=*&i:int [line 13]\n *&return:int =n$0 [line 13]\n " shape="box"] + + + 5 -> 4 ; +4 [label="4: Exit bar::lambda_lambda_lambda1.cpp:11:15_operator() \n " color=yellow style=filled] + + +3 [label="3: Start bar::lambda_lambda_lambda1.cpp:11:15_operator()\nFormals: this:class bar::lambda_lambda_lambda1.cpp:11:15 *\nLocals: i:int \n DECLARE_LOCALS(&return,&i); [line 11]\n " color=yellow style=filled] + + + 3 -> 6 ; +2 [label="2: Exit bar \n " color=yellow style=filled] + + +1 [label="1: Start bar\nFormals: \nLocals: func:class bar::lambda_lambda_lambda1.cpp:11:15 0$?%__sil_tmpSIL_materialize_temp__n$1:class bar::lambda_lambda_lambda1.cpp:11:15 \n DECLARE_LOCALS(&return,&func,&0$?%__sil_tmpSIL_materialize_temp__n$1); [line 10]\n " color=yellow style=filled] + + + 1 -> 10 ; +} diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp b/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp index 3584c810b..1cfe94dd4 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp @@ -8,6 +8,7 @@ */ class A { + public: struct AIn { int fun() { return 1; } }; diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp.dot index 34facc556..37a1599ba 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp.dot @@ -1,43 +1,43 @@ /* @generated */ digraph iCFG { -11 [label="11: Call _fun_A_fun \n n$4=*&a_ptr:class A * [line 24]\n _=*n$4:class A [line 24]\n n$6=_fun_A_fun(n$4:class A *) [line 24]\n " shape="box"] +11 [label="11: Call _fun_A_fun \n n$4=*&a_ptr:class A * [line 25]\n _=*n$4:class A [line 25]\n n$6=_fun_A_fun(n$4:class A *) [line 25]\n " shape="box"] 11 -> 10 ; -10 [label="10: Call _fun_A::AIn_fun \n n$0=*&a_ptr:class A * [line 25]\n n$1=*n$0.in:class A::AIn * [line 25]\n _=*n$1:class A::AIn [line 25]\n n$3=_fun_A::AIn_fun(n$1:class A::AIn *) [line 25]\n " shape="box"] +10 [label="10: Call _fun_A::AIn_fun \n n$0=*&a_ptr:class A * [line 26]\n n$1=*n$0.in:class A::AIn * [line 26]\n _=*n$1:class A::AIn [line 26]\n n$3=_fun_A::AIn_fun(n$1:class A::AIn *) [line 26]\n " shape="box"] 10 -> 9 ; 9 [label="9: Exit test_call \n " color=yellow style=filled] -8 [label="8: Start test_call\nFormals: \nLocals: a_ptr:class A * \n DECLARE_LOCALS(&return,&a_ptr); [line 22]\n " color=yellow style=filled] +8 [label="8: Start test_call\nFormals: \nLocals: a_ptr:class A * \n DECLARE_LOCALS(&return,&a_ptr); [line 23]\n " color=yellow style=filled] 8 -> 11 ; -7 [label="7: DeclStmt \n *&c:int =10 [line 17]\n " shape="box"] +7 [label="7: DeclStmt \n *&c:int =10 [line 18]\n " shape="box"] 7 -> 6 ; -6 [label="6: Return Stmt \n n$0=*&c:int [line 18]\n *&return:int =(n$0 + 1) [line 18]\n " shape="box"] +6 [label="6: Return Stmt \n n$0=*&c:int [line 19]\n *&return:int =(n$0 + 1) [line 19]\n " shape="box"] 6 -> 5 ; 5 [label="5: Exit A_fun \n " color=yellow style=filled] -4 [label="4: Start A_fun\nFormals: this:class A *\nLocals: c:int \n DECLARE_LOCALS(&return,&c); [line 16]\n " color=yellow style=filled] +4 [label="4: Start A_fun\nFormals: this:class A *\nLocals: c:int \n DECLARE_LOCALS(&return,&c); [line 17]\n " color=yellow style=filled] 4 -> 7 ; -3 [label="3: Return Stmt \n *&return:int =1 [line 12]\n " shape="box"] +3 [label="3: Return Stmt \n *&return:int =1 [line 13]\n " shape="box"] 3 -> 2 ; 2 [label="2: Exit A::AIn_fun \n " color=yellow style=filled] -1 [label="1: Start A::AIn_fun\nFormals: this:class A::AIn *\nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled] +1 [label="1: Start A::AIn_fun\nFormals: this:class A::AIn *\nLocals: \n DECLARE_LOCALS(&return); [line 13]\n " color=yellow style=filled] 1 -> 3 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp b/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp index 85902d972..6372b06e3 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp @@ -8,6 +8,7 @@ */ class A { + public: int fun(int a, int b); int fun(int a, int b, int c); }; diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp.dot index ebc17720c..7f478fb2b 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp.dot @@ -1,39 +1,39 @@ /* @generated */ digraph iCFG { -10 [label="10: Call _fun_A_fun \n n$3=*&a_ptr:class A * [line 22]\n _=*n$3:class A [line 22]\n n$5=_fun_A_fun(n$3:class A *,1:int ,2:int ) [line 22]\n " shape="box"] +10 [label="10: Call _fun_A_fun \n n$3=*&a_ptr:class A * [line 23]\n _=*n$3:class A [line 23]\n n$5=_fun_A_fun(n$3:class A *,1:int ,2:int ) [line 23]\n " shape="box"] 10 -> 9 ; -9 [label="9: Call _fun_A_fun \n n$0=*&a_ptr:class A * [line 23]\n _=*n$0:class A [line 23]\n n$2=_fun_A_fun(n$0:class A *,1:int ,2:int ,3:int ) [line 23]\n " shape="box"] +9 [label="9: Call _fun_A_fun \n n$0=*&a_ptr:class A * [line 24]\n _=*n$0:class A [line 24]\n n$2=_fun_A_fun(n$0:class A *,1:int ,2:int ,3:int ) [line 24]\n " shape="box"] 9 -> 8 ; 8 [label="8: Exit test \n " color=yellow style=filled] -7 [label="7: Start test\nFormals: \nLocals: a_ptr:class A * \n DECLARE_LOCALS(&return,&a_ptr); [line 19]\n " color=yellow style=filled] +7 [label="7: Start test\nFormals: \nLocals: a_ptr:class A * \n DECLARE_LOCALS(&return,&a_ptr); [line 20]\n " color=yellow style=filled] 7 -> 10 ; -6 [label="6: Return Stmt \n n$0=*&a:int [line 17]\n n$1=*&b:int [line 17]\n *&return:int =(n$0 - n$1) [line 17]\n " shape="box"] +6 [label="6: Return Stmt \n n$0=*&a:int [line 18]\n n$1=*&b:int [line 18]\n *&return:int =(n$0 - n$1) [line 18]\n " shape="box"] 6 -> 5 ; 5 [label="5: Exit A_fun \n " color=yellow style=filled] -4 [label="4: Start A_fun\nFormals: this:class A * a:int b:int \nLocals: \n DECLARE_LOCALS(&return); [line 17]\n " color=yellow style=filled] +4 [label="4: Start A_fun\nFormals: this:class A * a:int b:int \nLocals: \n DECLARE_LOCALS(&return); [line 18]\n " color=yellow style=filled] 4 -> 6 ; -3 [label="3: Return Stmt \n n$0=*&a:int [line 15]\n n$1=*&b:int [line 15]\n n$2=*&c:int [line 15]\n *&return:int =((n$0 + n$1) + n$2) [line 15]\n " shape="box"] +3 [label="3: Return Stmt \n n$0=*&a:int [line 16]\n n$1=*&b:int [line 16]\n n$2=*&c:int [line 16]\n *&return:int =((n$0 + n$1) + n$2) [line 16]\n " shape="box"] 3 -> 2 ; 2 [label="2: Exit A_fun \n " color=yellow style=filled] -1 [label="1: Start A_fun\nFormals: this:class A * a:int b:int c:int \nLocals: \n DECLARE_LOCALS(&return); [line 15]\n " color=yellow style=filled] +1 [label="1: Start A_fun\nFormals: this:class A * a:int b:int c:int \nLocals: \n DECLARE_LOCALS(&return); [line 16]\n " color=yellow style=filled] 1 -> 3 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/typeid_expr.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/types/typeid_expr.cpp.dot index fe5fea49c..141cdf3c8 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/types/typeid_expr.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/types/typeid_expr.cpp.dot @@ -1,277 +1,473 @@ /* @generated */ digraph iCFG { -70 [label="70: DeclStmt \n _fun_Person_Person(&person:class Person *) [line 63]\n " shape="box"] +125 [label="125: DeclStmt \n _fun_Person_Person(&person:class Person *) [line 63]\n " shape="box"] - 70 -> 65 ; -69 [label="69: Return Stmt \n *&return:int =(1 / 0) [line 67]\n " shape="box"] + 125 -> 120 ; +124 [label="124: Return Stmt \n *&return:int =(1 / 0) [line 67]\n " shape="box"] - 69 -> 62 ; -68 [label="68: Return Stmt \n *&return:int =1 [line 65]\n " shape="box"] + 124 -> 117 ; +123 [label="123: Return Stmt \n *&return:int =1 [line 65]\n " shape="box"] - 68 -> 62 ; -67 [label="67: Prune (false branch) \n PRUNE(((n$0 == n$3) == 0), false); [line 64]\n " shape="invhouse"] + 123 -> 117 ; +122 [label="122: Prune (false branch) \n PRUNE(((n$0 == n$3) == 0), false); [line 64]\n " shape="invhouse"] - 67 -> 69 ; -66 [label="66: Prune (true branch) \n PRUNE(((n$0 == n$3) != 0), true); [line 64]\n " shape="invhouse"] + 122 -> 124 ; +121 [label="121: Prune (true branch) \n PRUNE(((n$0 == n$3) != 0), true); [line 64]\n " shape="invhouse"] - 66 -> 68 ; -65 [label="65: BinaryOperatorStmt: EQ \n n$0=_fun_template_typeid(&person:class Person &) [line 64]\n n$1=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$1.__type_name:void ,&person:class Person ) [line 64]\n _=*n$1:class std::type_info [line 64]\n n$3=_fun_std::type_info_name(n$1:class std::type_info &) [line 64]\n " shape="box"] + 121 -> 123 ; +120 [label="120: BinaryOperatorStmt: EQ \n n$0=_fun_template_typeid(&person:class Person &) [line 64]\n n$1=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$1.__type_name:void ,&person:class Person ) [line 64]\n _=*n$1:class std::type_info [line 64]\n n$3=_fun_std::type_info_name(n$1:class std::type_info &) [line 64]\n " shape="box"] - 65 -> 66 ; - 65 -> 67 ; -64 [label="64: between_join_and_exit \n " shape="box"] + 120 -> 121 ; + 120 -> 122 ; +119 [label="119: between_join_and_exit \n " shape="box"] - 64 -> 62 ; -63 [label="63: + \n " ] + 119 -> 117 ; +118 [label="118: + \n " ] - 63 -> 64 ; -62 [label="62: Exit template_type_id_person \n " color=yellow style=filled] + 118 -> 119 ; +117 [label="117: Exit template_type_id_person \n " color=yellow style=filled] -61 [label="61: Start template_type_id_person\nFormals: \nLocals: person:class Person \n DECLARE_LOCALS(&return,&person); [line 62]\n " color=yellow style=filled] +116 [label="116: Start template_type_id_person\nFormals: \nLocals: person:class Person \n DECLARE_LOCALS(&return,&person); [line 62]\n " color=yellow style=filled] - 61 -> 70 ; -60 [label="60: DeclStmt \n n$4=*&value:class Person & [line 58]\n _fun_Person_Person(&0$?%__sil_tmpSIL_materialize_temp__n$3:class Person *,n$4:class Person &) [line 58]\n _fun_Person_Person(&result:class Person *,&0$?%__sil_tmpSIL_materialize_temp__n$3:class Person &) [line 58]\n " shape="box"] + 116 -> 125 ; +115 [label="115: DeclStmt \n n$4=*&value:class Person & [line 58]\n _fun_Person_Person(&0$?%__sil_tmpSIL_materialize_temp__n$3:class Person *,n$4:class Person &) [line 58]\n _fun_Person_Person(&result:class Person *,&0$?%__sil_tmpSIL_materialize_temp__n$3:class Person &) [line 58]\n " shape="box"] - 60 -> 59 ; -59 [label="59: Return Stmt \n n$0=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$0.__type_name:void ) [line 59]\n _=*n$0:class std::type_info [line 59]\n n$2=_fun_std::type_info_name(n$0:class std::type_info &) [line 59]\n *&return:char *=n$2 [line 59]\n " shape="box"] + 115 -> 114 ; +114 [label="114: Return Stmt \n n$0=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$0.__type_name:void ) [line 59]\n _=*n$0:class std::type_info [line 59]\n n$2=_fun_std::type_info_name(n$0:class std::type_info &) [line 59]\n *&return:char *=n$2 [line 59]\n " shape="box"] - 59 -> 58 ; -58 [label="58: Exit template_typeid \n " color=yellow style=filled] + 114 -> 113 ; +113 [label="113: Exit template_typeid \n " color=yellow style=filled] -57 [label="57: Start template_typeid\nFormals: value:class Person &\nLocals: result:class Person 0$?%__sil_tmpSIL_materialize_temp__n$3:class Person \n DECLARE_LOCALS(&return,&result,&0$?%__sil_tmpSIL_materialize_temp__n$3); [line 57]\n " color=yellow style=filled] +112 [label="112: Start template_typeid\nFormals: value:class Person &\nLocals: result:class Person 0$?%__sil_tmpSIL_materialize_temp__n$3:class Person \n DECLARE_LOCALS(&return,&result,&0$?%__sil_tmpSIL_materialize_temp__n$3); [line 57]\n " color=yellow style=filled] - 57 -> 60 ; -56 [label="56: DeclStmt \n _fun_Person_Person(&person:class Person *) [line 49]\n " shape="box"] + 112 -> 115 ; +111 [label="111: DeclStmt \n _fun_Person_Person(&person:class Person *) [line 49]\n " shape="box"] - 56 -> 51 ; -55 [label="55: Return Stmt \n *&return:int =0 [line 53]\n " shape="box"] + 111 -> 106 ; +110 [label="110: Return Stmt \n *&return:int =0 [line 53]\n " shape="box"] - 55 -> 48 ; -54 [label="54: Return Stmt \n *&return:int =(1 / 0) [line 51]\n " shape="box"] + 110 -> 103 ; +109 [label="109: Return Stmt \n *&return:int =(1 / 0) [line 51]\n " shape="box"] - 54 -> 48 ; -53 [label="53: Prune (false branch) \n PRUNE(((n$3 == n$6) == 0), false); [line 50]\n " shape="invhouse"] + 109 -> 103 ; +108 [label="108: Prune (false branch) \n PRUNE(((n$3 == n$6) == 0), false); [line 50]\n " shape="invhouse"] - 53 -> 55 ; -52 [label="52: Prune (true branch) \n PRUNE(((n$3 == n$6) != 0), true); [line 50]\n " shape="invhouse"] + 108 -> 110 ; +107 [label="107: Prune (true branch) \n PRUNE(((n$3 == n$6) != 0), true); [line 50]\n " shape="invhouse"] - 52 -> 54 ; -51 [label="51: BinaryOperatorStmt: EQ \n n$0=*&ptr:class Person * [line 50]\n n$1=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$1.__type_name:void ,n$0:class Person ) [line 50]\n _=*n$1:class std::type_info [line 50]\n n$3=_fun_std::type_info_name(n$1:class std::type_info &) [line 50]\n n$4=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$4.__type_name:void ,&person:class Person ) [line 50]\n _=*n$4:class std::type_info [line 50]\n n$6=_fun_std::type_info_name(n$4:class std::type_info &) [line 50]\n " shape="box"] + 107 -> 109 ; +106 [label="106: BinaryOperatorStmt: EQ \n n$0=*&ptr:class Person * [line 50]\n n$1=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$1.__type_name:void ,n$0:class Person ) [line 50]\n _=*n$1:class std::type_info [line 50]\n n$3=_fun_std::type_info_name(n$1:class std::type_info &) [line 50]\n n$4=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$4.__type_name:void ,&person:class Person ) [line 50]\n _=*n$4:class std::type_info [line 50]\n n$6=_fun_std::type_info_name(n$4:class std::type_info &) [line 50]\n " shape="box"] - 51 -> 52 ; - 51 -> 53 ; -50 [label="50: between_join_and_exit \n " shape="box"] + 106 -> 107 ; + 106 -> 108 ; +105 [label="105: between_join_and_exit \n " shape="box"] - 50 -> 48 ; -49 [label="49: + \n " ] + 105 -> 103 ; +104 [label="104: + \n " ] - 49 -> 50 ; -48 [label="48: Exit person_ptr_typeid \n " color=yellow style=filled] + 104 -> 105 ; +103 [label="103: Exit person_ptr_typeid \n " color=yellow style=filled] -47 [label="47: Start person_ptr_typeid\nFormals: ptr:class Person *\nLocals: person:class Person \n DECLARE_LOCALS(&return,&person); [line 48]\n " color=yellow style=filled] +102 [label="102: Start person_ptr_typeid\nFormals: ptr:class Person *\nLocals: person:class Person \n DECLARE_LOCALS(&return,&person); [line 48]\n " color=yellow style=filled] - 47 -> 56 ; -46 [label="46: DeclStmt \n _fun_Employee_Employee(&employee:class Employee *) [line 40]\n " shape="box"] + 102 -> 111 ; +101 [label="101: DeclStmt \n _fun_Employee_Employee(&employee:class Employee *) [line 40]\n " shape="box"] - 46 -> 45 ; -45 [label="45: DeclStmt \n *&ptr:class Employee *=&employee [line 41]\n " shape="box"] + 101 -> 100 ; +100 [label="100: DeclStmt \n *&ptr:class Employee *=&employee [line 41]\n " shape="box"] - 45 -> 40 ; -44 [label="44: Return Stmt \n *&return:int =0 [line 45]\n " shape="box"] + 100 -> 95 ; +99 [label="99: Return Stmt \n *&return:int =0 [line 45]\n " shape="box"] - 44 -> 37 ; -43 [label="43: Return Stmt \n *&return:int =(1 / 0) [line 43]\n " shape="box"] + 99 -> 92 ; +98 [label="98: Return Stmt \n *&return:int =(1 / 0) [line 43]\n " shape="box"] - 43 -> 37 ; -42 [label="42: Prune (false branch) \n PRUNE((n$3 == 0), false); [line 42]\n " shape="invhouse"] + 98 -> 92 ; +97 [label="97: Prune (false branch) \n PRUNE((n$3 == 0), false); [line 42]\n " shape="invhouse"] - 42 -> 44 ; -41 [label="41: Prune (true branch) \n PRUNE((n$3 != 0), true); [line 42]\n " shape="invhouse"] + 97 -> 99 ; +96 [label="96: Prune (true branch) \n PRUNE((n$3 != 0), true); [line 42]\n " shape="invhouse"] - 41 -> 43 ; -40 [label="40: Call _fun_std::type_info_operator== \n n$0=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$0.__type_name:void ,&employee:class Employee ) [line 42]\n n$1=*&ptr:class Person * [line 42]\n n$2=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$2.__type_name:void ,n$1:class Person ) [line 42]\n n$3=_fun_std::type_info_operator==(n$0:class std::type_info &,n$2:class std::type_info &) [line 42]\n " shape="box"] + 96 -> 98 ; +95 [label="95: Call _fun_std::type_info_operator== \n n$0=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$0.__type_name:void ,&employee:class Employee ) [line 42]\n n$1=*&ptr:class Person * [line 42]\n n$2=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$2.__type_name:void ,n$1:class Person ) [line 42]\n n$3=_fun_std::type_info_operator==(n$0:class std::type_info &,n$2:class std::type_info &) [line 42]\n " shape="box"] - 40 -> 41 ; - 40 -> 42 ; -39 [label="39: between_join_and_exit \n " shape="box"] + 95 -> 96 ; + 95 -> 97 ; +94 [label="94: between_join_and_exit \n " shape="box"] - 39 -> 37 ; -38 [label="38: + \n " ] + 94 -> 92 ; +93 [label="93: + \n " ] - 38 -> 39 ; -37 [label="37: Exit employee_typeid \n " color=yellow style=filled] + 93 -> 94 ; +92 [label="92: Exit employee_typeid \n " color=yellow style=filled] -36 [label="36: Start employee_typeid\nFormals: \nLocals: ptr:class Person * employee:class Employee \n DECLARE_LOCALS(&return,&ptr,&employee); [line 39]\n " color=yellow style=filled] +91 [label="91: Start employee_typeid\nFormals: \nLocals: ptr:class Person * employee:class Employee \n DECLARE_LOCALS(&return,&ptr,&employee); [line 39]\n " color=yellow style=filled] - 36 -> 46 ; -35 [label="35: DeclStmt \n _fun_Person_Person(&person:class Person *) [line 29]\n " shape="box"] + 91 -> 101 ; +90 [label="90: DeclStmt \n _fun_Person_Person(&person:class Person *) [line 29]\n " shape="box"] + + + 90 -> 89 ; +89 [label="89: DeclStmt \n *&t:int =3 [line 30]\n " shape="box"] + + + 89 -> 88 ; +88 [label="88: DeclStmt \n n$5=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$5.__type_name:void ,&t:int ) [line 31]\n _=*n$5:class std::type_info [line 31]\n n$7=_fun_std::type_info_name(n$5:class std::type_info &) [line 31]\n *&t_type_info:char *=n$7 [line 31]\n " shape="box"] + + + 88 -> 87 ; +87 [label="87: DeclStmt \n n$2=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$2.__type_name:void ,&person:class Person ) [line 32]\n _=*n$2:class std::type_info [line 32]\n n$4=_fun_std::type_info_name(n$2:class std::type_info &) [line 32]\n *&person_type_info:char *=n$4 [line 32]\n " shape="box"] + + + 87 -> 82 ; +86 [label="86: Return Stmt \n *&return:int =(1 / 0) [line 36]\n " shape="box"] + + + 86 -> 79 ; +85 [label="85: Return Stmt \n *&return:int =0 [line 34]\n " shape="box"] + + + 85 -> 79 ; +84 [label="84: Prune (false branch) \n PRUNE(((n$0 == n$1) == 0), false); [line 33]\n " shape="invhouse"] + + + 84 -> 86 ; +83 [label="83: Prune (true branch) \n PRUNE(((n$0 == n$1) != 0), true); [line 33]\n " shape="invhouse"] + + + 83 -> 85 ; +82 [label="82: BinaryOperatorStmt: EQ \n n$0=*&t_type_info:char * [line 33]\n n$1=*&person_type_info:char * [line 33]\n " shape="box"] + + + 82 -> 83 ; + 82 -> 84 ; +81 [label="81: between_join_and_exit \n " shape="box"] + + + 81 -> 79 ; +80 [label="80: + \n " ] + + + 80 -> 81 ; +79 [label="79: Exit person_typeid_name \n " color=yellow style=filled] + + +78 [label="78: Start person_typeid_name\nFormals: \nLocals: person_type_info:char * t_type_info:char * t:int person:class Person \n DECLARE_LOCALS(&return,&person_type_info,&t_type_info,&t,&person); [line 28]\n " color=yellow style=filled] + + + 78 -> 90 ; +77 [label="77: DeclStmt \n _fun_Person_Person(&person:class Person *) [line 20]\n " shape="box"] + + + 77 -> 76 ; +76 [label="76: DeclStmt \n *&t:int =3 [line 21]\n " shape="box"] + + + 76 -> 71 ; +75 [label="75: Return Stmt \n *&return:int =(1 / 0) [line 25]\n " shape="box"] + + + 75 -> 68 ; +74 [label="74: Return Stmt \n *&return:int =1 [line 23]\n " shape="box"] + + + 74 -> 68 ; +73 [label="73: Prune (false branch) \n PRUNE((n$2 == 0), false); [line 22]\n " shape="invhouse"] + + + 73 -> 75 ; +72 [label="72: Prune (true branch) \n PRUNE((n$2 != 0), true); [line 22]\n " shape="invhouse"] + + + 72 -> 74 ; +71 [label="71: Call _fun_std::type_info_operator== \n n$0=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$0.__type_name:void ,&t:int ) [line 22]\n n$1=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$1.__type_name:void ,&person:class Person ) [line 22]\n n$2=_fun_std::type_info_operator==(n$0:class std::type_info &,n$1:class std::type_info &) [line 22]\n " shape="box"] + + + 71 -> 72 ; + 71 -> 73 ; +70 [label="70: between_join_and_exit \n " shape="box"] + + + 70 -> 68 ; +69 [label="69: + \n " ] + + + 69 -> 70 ; +68 [label="68: Exit person_typeid \n " color=yellow style=filled] + + +67 [label="67: Start person_typeid\nFormals: \nLocals: t:int person:class Person \n DECLARE_LOCALS(&return,&t,&person); [line 19]\n " color=yellow style=filled] + + + 67 -> 77 ; +66 [label="66: Constructor Init \n n$0=*&this:class Employee * [line 17]\n _fun_Person_Person(n$0:class Employee *) [line 17]\n " shape="box"] + + + 66 -> 65 ; +65 [label="65: Exit Employee_Employee \n " color=yellow style=filled] + + +64 [label="64: Start Employee_Employee\nFormals: this:class Employee *\nLocals: \n DECLARE_LOCALS(&return); [line 17]\n " color=yellow style=filled] + + + 64 -> 66 ; +63 [label="63: Exit Employee_~Employee \n " color=yellow style=filled] + + +62 [label="62: Start Employee_~Employee\nFormals: this:class Employee *\nLocals: \n DECLARE_LOCALS(&return); [line 17]\n " color=yellow style=filled] + + + 62 -> 63 ; +61 [label="61: Exit Person_Person \n " color=yellow style=filled] + + +60 [label="60: Start Person_Person\nFormals: this:class Person *\nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled] + + + 60 -> 61 ; +59 [label="59: Exit Person_Person \n " color=yellow style=filled] + + +58 [label="58: Start Person_Person\nFormals: this:class Person * __param_0:class Person &\nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled] + + + 58 -> 59 ; +57 [label="57: Exit Person_~Person \n " color=yellow style=filled] + + +56 [label="56: Start Person_~Person\nFormals: this:class Person *\nLocals: \n DECLARE_LOCALS(&return); [line 14]\n " color=yellow style=filled] + + + 56 -> 57 ; +55 [label="55: Exit std::type_info_operator!= \n " color=yellow style=filled] + + +54 [label="54: Start std::type_info_operator!=\nFormals: this:class std::type_info * __arg:class std::type_info &\nLocals: \n " color=yellow style=filled] + + +53 [label="53: Exit std::type_info_operator== \n " color=yellow style=filled] + + +52 [label="52: Start std::type_info_operator==\nFormals: this:class std::type_info * __arg:class std::type_info &\nLocals: \n " color=yellow style=filled] + + +51 [label="51: Return Stmt \n n$0=*&this:class std::type_info * [line 116]\n n$1=*n$0.__type_name:unsigned long [line 116]\n *&return:unsigned long =n$1 [line 116]\n " shape="box"] + + + 51 -> 50 ; +50 [label="50: Exit std::type_info_hash_code \n " color=yellow style=filled] + + +49 [label="49: Start std::type_info_hash_code\nFormals: this:class std::type_info *\nLocals: \n DECLARE_LOCALS(&return); [line 113]\n " color=yellow style=filled] + + + 49 -> 51 ; +48 [label="48: Return Stmt \n n$0=*&this:class std::type_info * [line 106]\n n$1=*n$0.__type_name:char * [line 106]\n n$2=*&__arg:class std::type_info & [line 106]\n n$3=*n$2.__type_name:char * [line 106]\n *&return:_Bool =(n$1 < n$3) [line 106]\n " shape="box"] + + + 48 -> 47 ; +47 [label="47: Exit std::type_info_before \n " color=yellow style=filled] + + +46 [label="46: Start std::type_info_before\nFormals: this:class std::type_info * __arg:class std::type_info &\nLocals: \n DECLARE_LOCALS(&return); [line 103]\n " color=yellow style=filled] + + + 46 -> 48 ; +45 [label="45: Exit std::type_info_name \n " color=yellow style=filled] + + +44 [label="44: Start std::type_info_name\nFormals: this:class std::type_info *\nLocals: \n " color=yellow style=filled] + + +43 [label="43: Exit std::type_info_type_info \n " color=yellow style=filled] + + +42 [label="42: Start std::type_info_type_info\nFormals: this:class std::type_info * __n:char *\nLocals: \n " color=yellow style=filled] + + +41 [label="41: Return Stmt \n n$0=*&__return_param:class std::exception_ptr * [line 180]\n n$1=*&this:class std::nested_exception * [line 180]\n _fun_std::exception_ptr_exception_ptr(n$0:class std::exception_ptr *,n$1.__ptr_:class std::exception_ptr &) [line 180]\n " shape="box"] + + + 41 -> 40 ; +40 [label="40: Exit std::nested_exception_nested_ptr \n " color=yellow style=filled] + + +39 [label="39: Start std::nested_exception_nested_ptr\nFormals: this:class std::nested_exception * __return_param:class std::exception_ptr *\nLocals: \n DECLARE_LOCALS(&return); [line 180]\n " color=yellow style=filled] + + + 39 -> 41 ; +38 [label="38: Return Stmt \n n$0=*&this:class std::exception_ptr * [line 138]\n n$1=*n$0.__ptr_:void * [line 138]\n *&return:_Bool =(n$1 != null) [line 138]\n " shape="box"] + + + 38 -> 37 ; +37 [label="37: Exit std::exception_ptr_operator_bool \n " color=yellow style=filled] + + +36 [label="36: Start std::exception_ptr_operator_bool\nFormals: this:class std::exception_ptr *\nLocals: \n DECLARE_LOCALS(&return); [line 136]\n " color=yellow style=filled] + + + 36 -> 38 ; +35 [label="35: Constructor Init \n n$0=*&this:class std::exception_ptr * [line 131]\n *n$0.__ptr_:void *=null [line 131]\n " shape="box"] 35 -> 34 ; -34 [label="34: DeclStmt \n *&t:int =3 [line 30]\n " shape="box"] +34 [label="34: Exit std::exception_ptr_exception_ptr \n " color=yellow style=filled] - 34 -> 33 ; -33 [label="33: DeclStmt \n n$5=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$5.__type_name:void ,&t:int ) [line 31]\n _=*n$5:class std::type_info [line 31]\n n$7=_fun_std::type_info_name(n$5:class std::type_info &) [line 31]\n *&t_type_info:char *=n$7 [line 31]\n " shape="box"] +33 [label="33: Start std::exception_ptr_exception_ptr\nFormals: this:class std::exception_ptr * __param_0:int \nLocals: \n DECLARE_LOCALS(&return); [line 131]\n " color=yellow style=filled] - 33 -> 32 ; -32 [label="32: DeclStmt \n n$2=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$2.__type_name:void ,&person:class Person ) [line 32]\n _=*n$2:class std::type_info [line 32]\n n$4=_fun_std::type_info_name(n$2:class std::type_info &) [line 32]\n *&person_type_info:char *=n$4 [line 32]\n " shape="box"] + 33 -> 35 ; +32 [label="32: Constructor Init \n n$0=*&this:class std::exception_ptr * [line 130]\n *n$0.__ptr_:void *=null [line 130]\n " shape="box"] - 32 -> 27 ; -31 [label="31: Return Stmt \n *&return:int =(1 / 0) [line 36]\n " shape="box"] + 32 -> 31 ; +31 [label="31: Exit std::exception_ptr_exception_ptr \n " color=yellow style=filled] - 31 -> 24 ; -30 [label="30: Return Stmt \n *&return:int =0 [line 34]\n " shape="box"] +30 [label="30: Start std::exception_ptr_exception_ptr\nFormals: this:class std::exception_ptr *\nLocals: \n DECLARE_LOCALS(&return); [line 130]\n " color=yellow style=filled] - 30 -> 24 ; -29 [label="29: Prune (false branch) \n PRUNE(((n$0 == n$1) == 0), false); [line 33]\n " shape="invhouse"] + 30 -> 32 ; +29 [label="29: Constructor Init \n n$0=*&this:class std::bad_exception * [line 103]\n _fun_std::exception_exception(n$0:class std::bad_exception *) [line 103]\n " shape="box"] - 29 -> 31 ; -28 [label="28: Prune (true branch) \n PRUNE(((n$0 == n$1) != 0), true); [line 33]\n " shape="invhouse"] + 29 -> 28 ; +28 [label="28: Exit std::bad_exception_bad_exception \n " color=yellow style=filled] - 28 -> 30 ; -27 [label="27: BinaryOperatorStmt: EQ \n n$0=*&t_type_info:char * [line 33]\n n$1=*&person_type_info:char * [line 33]\n " shape="box"] +27 [label="27: Start std::bad_exception_bad_exception\nFormals: this:class std::bad_exception *\nLocals: \n DECLARE_LOCALS(&return); [line 103]\n " color=yellow style=filled] - 27 -> 28 ; 27 -> 29 ; -26 [label="26: between_join_and_exit \n " shape="box"] +26 [label="26: Exit std::exception_exception \n " color=yellow style=filled] - 26 -> 24 ; -25 [label="25: + \n " ] +25 [label="25: Start std::exception_exception\nFormals: this:class std::exception *\nLocals: \n DECLARE_LOCALS(&return); [line 94]\n " color=yellow style=filled] 25 -> 26 ; -24 [label="24: Exit person_typeid_name \n " color=yellow style=filled] +24 [label="24: Return Stmt \n n$0=*&__val:unsigned int [line 4332]\n *&return:unsigned int =n$0 [line 4332]\n " shape="box"] -23 [label="23: Start person_typeid_name\nFormals: \nLocals: person_type_info:char * t_type_info:char * t:int person:class Person \n DECLARE_LOCALS(&return,&person_type_info,&t_type_info,&t,&person); [line 28]\n " color=yellow style=filled] + 24 -> 23 ; +23 [label="23: Exit std::__1::__convert_to_integral \n " color=yellow style=filled] - 23 -> 35 ; -22 [label="22: DeclStmt \n _fun_Person_Person(&person:class Person *) [line 20]\n " shape="box"] +22 [label="22: Start std::__1::__convert_to_integral\nFormals: __val:unsigned int \nLocals: \n DECLARE_LOCALS(&return); [line 4331]\n " color=yellow style=filled] - 22 -> 21 ; -21 [label="21: DeclStmt \n *&t:int =3 [line 21]\n " shape="box"] + 22 -> 24 ; +21 [label="21: Return Stmt \n n$0=*&__val:int [line 4329]\n *&return:int =n$0 [line 4329]\n " shape="box"] - 21 -> 16 ; -20 [label="20: Return Stmt \n *&return:int =(1 / 0) [line 25]\n " shape="box"] + 21 -> 20 ; +20 [label="20: Exit std::__1::__convert_to_integral \n " color=yellow style=filled] - 20 -> 13 ; -19 [label="19: Return Stmt \n *&return:int =1 [line 23]\n " shape="box"] +19 [label="19: Start std::__1::__convert_to_integral\nFormals: __val:int \nLocals: \n DECLARE_LOCALS(&return); [line 4328]\n " color=yellow style=filled] - 19 -> 13 ; -18 [label="18: Prune (false branch) \n PRUNE((n$2 == 0), false); [line 22]\n " shape="invhouse"] + 19 -> 21 ; +18 [label="18: Return Stmt \n n$0=*&__val:unsigned long long [line 4325]\n *&return:unsigned long long =n$0 [line 4325]\n " shape="box"] - 18 -> 20 ; -17 [label="17: Prune (true branch) \n PRUNE((n$2 != 0), true); [line 22]\n " shape="invhouse"] + 18 -> 17 ; +17 [label="17: Exit std::__1::__convert_to_integral \n " color=yellow style=filled] - 17 -> 19 ; -16 [label="16: Call _fun_std::type_info_operator== \n n$0=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$0.__type_name:void ,&t:int ) [line 22]\n n$1=_fun___cxx_typeid(sizeof(class std::type_info ):void ,n$1.__type_name:void ,&person:class Person ) [line 22]\n n$2=_fun_std::type_info_operator==(n$0:class std::type_info &,n$1:class std::type_info &) [line 22]\n " shape="box"] +16 [label="16: Start std::__1::__convert_to_integral\nFormals: __val:unsigned long long \nLocals: \n DECLARE_LOCALS(&return); [line 4324]\n " color=yellow style=filled] - 16 -> 17 ; 16 -> 18 ; -15 [label="15: between_join_and_exit \n " shape="box"] +15 [label="15: Return Stmt \n n$0=*&__val:long long [line 4322]\n *&return:long long =n$0 [line 4322]\n " shape="box"] - 15 -> 13 ; -14 [label="14: + \n " ] + 15 -> 14 ; +14 [label="14: Exit std::__1::__convert_to_integral \n " color=yellow style=filled] - 14 -> 15 ; -13 [label="13: Exit person_typeid \n " color=yellow style=filled] +13 [label="13: Start std::__1::__convert_to_integral\nFormals: __val:long long \nLocals: \n DECLARE_LOCALS(&return); [line 4321]\n " color=yellow style=filled] -12 [label="12: Start person_typeid\nFormals: \nLocals: t:int person:class Person \n DECLARE_LOCALS(&return,&t,&person); [line 19]\n " color=yellow style=filled] + 13 -> 15 ; +12 [label="12: Return Stmt \n n$0=*&__val:unsigned long [line 4319]\n *&return:unsigned long =n$0 [line 4319]\n " shape="box"] - 12 -> 22 ; -11 [label="11: Constructor Init \n n$0=*&this:class Employee * [line 17]\n _fun_Person_Person(n$0:class Employee *) [line 17]\n " shape="box"] + 12 -> 11 ; +11 [label="11: Exit std::__1::__convert_to_integral \n " color=yellow style=filled] - 11 -> 10 ; -10 [label="10: Exit Employee_Employee \n " color=yellow style=filled] +10 [label="10: Start std::__1::__convert_to_integral\nFormals: __val:unsigned long \nLocals: \n DECLARE_LOCALS(&return); [line 4318]\n " color=yellow style=filled] -9 [label="9: Start Employee_Employee\nFormals: this:class Employee *\nLocals: \n DECLARE_LOCALS(&return); [line 17]\n " color=yellow style=filled] + 10 -> 12 ; +9 [label="9: Return Stmt \n n$0=*&__val:long [line 4316]\n *&return:long =n$0 [line 4316]\n " shape="box"] - 9 -> 11 ; -8 [label="8: Exit Employee_~Employee \n " color=yellow style=filled] + 9 -> 8 ; +8 [label="8: Exit std::__1::__convert_to_integral \n " color=yellow style=filled] -7 [label="7: Start Employee_~Employee\nFormals: this:class Employee *\nLocals: \n DECLARE_LOCALS(&return); [line 17]\n " color=yellow style=filled] +7 [label="7: Start std::__1::__convert_to_integral\nFormals: __val:long \nLocals: \n DECLARE_LOCALS(&return); [line 4315]\n " color=yellow style=filled] - 7 -> 8 ; -6 [label="6: Exit Person_Person \n " color=yellow style=filled] + 7 -> 9 ; +6 [label="6: Return Stmt \n n$0=*&__val:unsigned int [line 4313]\n *&return:unsigned int =n$0 [line 4313]\n " shape="box"] -5 [label="5: Start Person_Person\nFormals: this:class Person *\nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled] + 6 -> 5 ; +5 [label="5: Exit std::__1::__convert_to_integral \n " color=yellow style=filled] - 5 -> 6 ; -4 [label="4: Exit Person_Person \n " color=yellow style=filled] +4 [label="4: Start std::__1::__convert_to_integral\nFormals: __val:unsigned int \nLocals: \n DECLARE_LOCALS(&return); [line 4312]\n " color=yellow style=filled] -3 [label="3: Start Person_Person\nFormals: this:class Person * __param_0:class Person &\nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled] + 4 -> 6 ; +3 [label="3: Return Stmt \n n$0=*&__val:int [line 4310]\n *&return:int =n$0 [line 4310]\n " shape="box"] - 3 -> 4 ; -2 [label="2: Exit Person_~Person \n " color=yellow style=filled] + 3 -> 2 ; +2 [label="2: Exit std::__1::__convert_to_integral \n " color=yellow style=filled] -1 [label="1: Start Person_~Person\nFormals: this:class Person *\nLocals: \n DECLARE_LOCALS(&return); [line 14]\n " color=yellow style=filled] +1 [label="1: Start std::__1::__convert_to_integral\nFormals: __val:int \nLocals: \n DECLARE_LOCALS(&return); [line 4309]\n " color=yellow style=filled] - 1 -> 2 ; + 1 -> 3 ; } diff --git a/infer/tests/frontend/BUCK b/infer/tests/frontend/BUCK index e5345359d..da2708ce2 100644 --- a/infer/tests/frontend/BUCK +++ b/infer/tests/frontend/BUCK @@ -12,8 +12,6 @@ tests_dependencies = [ integration_tests = [ '//infer/tests:integration_tests', '//infer/tests:objc_tests', - '//infer/tests:c_tests', - '//infer/tests:cpp_tests', '//infer/tests:objcpp_tests', ] @@ -40,51 +38,6 @@ java_test( visibility=integration_tests, ) -# ############### c frontend tests ######################## - -c_test_sources = glob(['c/**/*.java']) -c_frontend_test_deps = [] -for test_source in c_test_sources: - target_name = test_source.replace("/", "_")[:-len(".java")] - c_frontend_test_deps.append(target_name) - - java_test( - name=target_name, - srcs=[test_source], - deps=tests_dependencies, - visibility=integration_tests, - source='7', - target='7', - ) - -java_test( - name='c_frontend_tests', - deps=[':' + x for x in c_frontend_test_deps], - visibility=integration_tests, -) - -# ############### cpp frontend tests ######################## - -cpp_test_sources = glob(['cpp/**/*.java']) -cpp_frontend_test_deps = [] -for test_source in cpp_test_sources: - target_name = test_source.replace("/", "_")[:-len(".java")] - cpp_frontend_test_deps.append(target_name) - - java_test( - name=target_name, - srcs=[test_source], - deps=tests_dependencies, - visibility=integration_tests, - source='7', - target='7', - ) - -java_test( - name='cpp_frontend_tests', - deps=[':' + x for x in cpp_frontend_test_deps], - visibility=integration_tests, -) # ############### objcpp frontend tests ######################## diff --git a/infer/tests/frontend/c/ArithmeticExpTest.java b/infer/tests/frontend/c/ArithmeticExpTest.java deleted file mode 100644 index ec7316fa0..000000000 --- a/infer/tests/frontend/c/ArithmeticExpTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class ArithmeticExpTest { - - String arithmeticBasePath = "infer/tests/codetoanalyze/c/frontend/arithmetic/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCDotFiles(folder, arithmeticBasePath + fileRelative); - } - - @Test - public void whenCaptureRunOnPlus_exprThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("plus_expr.c"); - } - - @Test - public void whenCaptureRunOnCompound_assignmentThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("compound_assignment.c"); - } - - @Test - public void whenCaptureRunOnUnaryThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("unary.c"); - } - - @Test - public void whenCaptureRunOnIntConstThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("int_const.c"); - } - - @Test - public void whenCaptureRunOnNegateThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("negate.c"); - } - -} diff --git a/infer/tests/frontend/c/AssertionTest.java b/infer/tests/frontend/c/AssertionTest.java deleted file mode 100644 index 1ca08a9b2..000000000 --- a/infer/tests/frontend/c/AssertionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class AssertionTest { - - String conditionalOperatorBasePath = "infer/tests/codetoanalyze/c/frontend/assertions/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCDotFiles( - folder, - conditionalOperatorBasePath + fileRelative); - } - - @Ignore @Test - public void whenCaptureRunOnAssertExampleThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("assert_example.c"); - } - -} diff --git a/infer/tests/frontend/c/BoolTest.java b/infer/tests/frontend/c/BoolTest.java deleted file mode 100644 index 3a96af6cc..000000000 --- a/infer/tests/frontend/c/BoolTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class BoolTest { - - String boolBasePath = "infer/tests/codetoanalyze/c/frontend/booleans/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCDotFiles(folder, boolBasePath + fileRelative); - } - - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("bool_example.c"); - } - - @Test - public void whenCaptureBooleanConditionAsParamThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("condition_as_param.c"); - } -} diff --git a/infer/tests/frontend/c/CommaOperatorTest.java b/infer/tests/frontend/c/CommaOperatorTest.java deleted file mode 100644 index 286ae7224..000000000 --- a/infer/tests/frontend/c/CommaOperatorTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class CommaOperatorTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = "infer/tests/codetoanalyze/c/frontend/comma/comma.c"; - ClangFrontendUtils.createAndCompareCDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/c/ConditionalOperatorTest.java b/infer/tests/frontend/c/ConditionalOperatorTest.java deleted file mode 100644 index 010d38c5f..000000000 --- a/infer/tests/frontend/c/ConditionalOperatorTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class ConditionalOperatorTest { - - String conditionalOperatorBasePath = "infer/tests/codetoanalyze/c/frontend/conditional_operator/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCDotFiles(folder, conditionalOperatorBasePath + fileRelative); - } - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("conditional_operator.c"); - } - - @Test - public void whenCaptureRunShortCThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("if_short_circuit.c"); - } - - @Test - public void whenCaptureRunCond2ThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("cond2.c"); - } - - @Test - public void whenCaptureRunOnIntNegationThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("int_negation.c"); - } - - @Test - public void whenCaptureRunBinaryOperatorThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("binary_operator.c"); - } - - @Test - public void whenCaptureRunUnaryOperatorThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("unary_operator.c"); - } - - @Test - public void whenCaptureRunArrayAccessThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("array_access.c"); - } - - @Test - public void whenCaptureRunMemberAccessThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("member_access.c"); - } - - @Test - public void whenCaptureRunPreincrementThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("preincrement.c"); - } - - @Test - public void whenCaptureRunFunctionCallThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("function_call.c"); - } - -} diff --git a/infer/tests/frontend/c/EnumerationTest.java b/infer/tests/frontend/c/EnumerationTest.java deleted file mode 100644 index d12677088..000000000 --- a/infer/tests/frontend/c/EnumerationTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class EnumerationTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - - @Test - public void whenCaptureRunEnumThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = "infer/tests/codetoanalyze/c/frontend/enumeration/enum.c"; - ClangFrontendUtils.createAndCompareCDotFiles(folder, src); - } - - @Test - public void whenCaptureRunOnOtherEnumThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = "infer/tests/codetoanalyze/c/frontend/enumeration/other_enum.c"; - ClangFrontendUtils.createAndCompareCDotFiles(folder, src); - } - - @Test - public void whenCaptureRunOnEnumBitmaskThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = "infer/tests/codetoanalyze/c/frontend/enumeration/enum_bitmask.c"; - ClangFrontendUtils.createAndCompareCDotFiles(folder, src); - } - -} diff --git a/infer/tests/frontend/c/GnuexprTest.java b/infer/tests/frontend/c/GnuexprTest.java deleted file mode 100644 index 1e32f79b0..000000000 --- a/infer/tests/frontend/c/GnuexprTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class GnuexprTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - - @Test - public void whenCaptureRunOnWhileThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/" + - "c/frontend/nestedoperators/gnuexpr.c"; - ClangFrontendUtils.createAndCompareCDotFiles(folder, src); - } - -} diff --git a/infer/tests/frontend/c/GotoStmtLabelStmtTest.java b/infer/tests/frontend/c/GotoStmtLabelStmtTest.java deleted file mode 100644 index 15a5804f6..000000000 --- a/infer/tests/frontend/c/GotoStmtLabelStmtTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class GotoStmtLabelStmtTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - - @Test - public void whenCaptureRunGotoStmtThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = "infer/tests/codetoanalyze/c/frontend/gotostmt/goto_ex.c"; - ClangFrontendUtils.createAndCompareCDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/c/InitListExprTest.java b/infer/tests/frontend/c/InitListExprTest.java deleted file mode 100644 index 1a7b0c0af..000000000 --- a/infer/tests/frontend/c/InitListExprTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class InitListExprTest { - - String initListBasePath = "infer/tests/codetoanalyze/c/frontend/initialization/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCDotFiles(folder, initListBasePath + fileRelative); - } - - @Test - public void whenCaptureRunOnArrayInitListExprThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("array_initlistexpr.c"); - } - - @Test - public void whenCaptureRunOnStructInitListExprThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("struct_initlistexpr.c"); - } - - @Test - public void whenCaptureRunOnCompoundLiteralExprThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("compound_literal.c"); - } - -} diff --git a/infer/tests/frontend/c/LoopsTest.java b/infer/tests/frontend/c/LoopsTest.java deleted file mode 100644 index 4c81cb42c..000000000 --- a/infer/tests/frontend/c/LoopsTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class LoopsTest { - - String loopsBasePath = "infer/tests/codetoanalyze/c/frontend/loops/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCDotFiles(folder, loopsBasePath + fileRelative); - } - - - @Test - public void whenCaptureRunOnWhileThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("while.c"); - } - - @Test - public void whenCaptureRunOnWhile_nestedThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("while_nested.c"); - } - - @Test - public void whenCaptureRunOnWhile_side_effectsThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("while_condition_side_effects.c"); - } - - @Test - public void whenCaptureRunOnWhile_no_bodyThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("while_no_body.c"); - } - - @Test - public void whenCaptureRunOnForside_effectsThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("for_condition_side_effects.c"); - } - - @Test - public void whenCaptureRunOnFor_nestedThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("for_nested.c"); - } - - @Test - public void whenCaptureRunOnFor_no_conditionThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("for_no_condition.c"); - } - - @Test - public void whenCaptureRunOnFor_no_conditionincrThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("for_no_condition_incr.c"); - } - - @Test - public void whenCaptureRunOnFor_emptyThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("for_no_condition_incr_body.c"); - } - - @Test - public void whenCaptureRunOnFor_only_bodyThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("for_only_body.c"); - } - - @Test - public void whenCaptureRunOnFor_simpleThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("for_simple.c"); - } - - @Test - public void whenCaptureRunOnFor_while_nestedThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("for_while_nested.c"); - } - - @Test - public void whenCaptureRunOnDo_whileThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("do_while.c"); - } - - @Test - public void whenCaptureRunOnDo_while_side_effectsThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("do_while_condition_side_effects.c"); - } - - @Test - public void whenCaptureRunOnDo_while_nestedThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("do_while_nested.c"); - } - - @Test - public void whenCaptureWhile_with_continue_and_breakThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("while_with_continue_and_break.c"); - } -} diff --git a/infer/tests/frontend/c/NestedOperatorsTest.java b/infer/tests/frontend/c/NestedOperatorsTest.java deleted file mode 100644 index 793822afd..000000000 --- a/infer/tests/frontend/c/NestedOperatorsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - - -public class NestedOperatorsTest { - - String nestedOperatorsBasePath = "infer/tests/codetoanalyze/c/frontend/nestedoperators/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCDotFiles(folder, nestedOperatorsBasePath + fileRelative); - } - - - @Test - public void whenCaptureRunEnumThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("nestedassignment.c"); - } - - @Test - public void whenCaptureRunUnionThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("union.c"); - } - - @Test - public void whenCaptureRunAssignInConditionThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("assign_in_condition.c"); - } - - @Test - public void whenCaptureRunAssignWithIncrementThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("assign_with_increment.c"); - } -} diff --git a/infer/tests/frontend/c/OffsetOfExprTest.java b/infer/tests/frontend/c/OffsetOfExprTest.java deleted file mode 100644 index a95f85022..000000000 --- a/infer/tests/frontend/c/OffsetOfExprTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2016 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.ClangFrontendUtils; -import utils.DebuggableTemporaryFolder; -import utils.InferException; - -public class OffsetOfExprTest { - String FILE = "infer/tests/codetoanalyze/c/frontend/offsetof_expr/offsetof_expr.c"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void frontendTest() throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCDotFiles(folder, FILE); - } -} diff --git a/infer/tests/frontend/c/PrototypeTest.java b/infer/tests/frontend/c/PrototypeTest.java deleted file mode 100644 index 0800a88e2..000000000 --- a/infer/tests/frontend/c/PrototypeTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class PrototypeTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - - @Test - public void whenCaptureRunOnC_prototypeThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/" + - "c/frontend/c_prototype/prototype.c"; - ClangFrontendUtils.createAndCompareCDotFiles(folder, src); - } - -} diff --git a/infer/tests/frontend/c/SwitchStmtTest.java b/infer/tests/frontend/c/SwitchStmtTest.java deleted file mode 100644 index 663fed229..000000000 --- a/infer/tests/frontend/c/SwitchStmtTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class SwitchStmtTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunSwitchStmtThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = "infer/tests/codetoanalyze/c/frontend/switchstmt/switch.c"; - ClangFrontendUtils.createAndCompareCDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/c/TypesTest.java b/infer/tests/frontend/c/TypesTest.java deleted file mode 100644 index 91d91aed6..000000000 --- a/infer/tests/frontend/c/TypesTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; -import utils.InferRunner; - -public class TypesTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunStructThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = "infer/tests/codetoanalyze/c/frontend/types/struct.c"; - ClangFrontendUtils.createAndCompareCDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/c/UnusualExprTest.java b/infer/tests/frontend/c/UnusualExprTest.java deleted file mode 100644 index 2e1335904..000000000 --- a/infer/tests/frontend/c/UnusualExprTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class UnusualExprTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunEnumThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = "infer/tests/codetoanalyze/c/frontend/unusual_exps/generic_exp.c"; - ClangFrontendUtils.createAndCompareCDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/c/UnusualStmtsTest.java b/infer/tests/frontend/c/UnusualStmtsTest.java deleted file mode 100644 index c72965772..000000000 --- a/infer/tests/frontend/c/UnusualStmtsTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class UnusualStmtsTest { - - String boolBasePath = "infer/tests/codetoanalyze/c/frontend/unusual_stmts/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCDotFiles(folder, boolBasePath + fileRelative); - } - - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("asm.c"); - } - -} diff --git a/infer/tests/frontend/c/VAArgExprTest.java b/infer/tests/frontend/c/VAArgExprTest.java deleted file mode 100644 index 3527b0923..000000000 --- a/infer/tests/frontend/c/VAArgExprTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2016 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.c; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.ClangFrontendUtils; -import utils.DebuggableTemporaryFolder; -import utils.InferException; - -public class VAArgExprTest { - String FILE = "infer/tests/codetoanalyze/c/frontend/vaarg_expr/vaarg_expr.c"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void frontendTest() throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCDotFiles(folder, FILE); - } -} diff --git a/infer/tests/frontend/cpp/AttributesTest.java b/infer/tests/frontend/cpp/AttributesTest.java deleted file mode 100644 index 3eddc93b3..000000000 --- a/infer/tests/frontend/cpp/AttributesTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class AttributesTest { - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/attributes/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void testClangFallthroughDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("clang_fallthrough.cpp"); - } - - @Test - public void testDeprecatedHackDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("deprecated_hack.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/CastsTest.java b/infer/tests/frontend/cpp/CastsTest.java deleted file mode 100644 index 1ac54bca6..000000000 --- a/infer/tests/frontend/cpp/CastsTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class CastsTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/cpp/frontend/types/casts.cpp"; - ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/cpp/ClassTest.java b/infer/tests/frontend/cpp/ClassTest.java deleted file mode 100644 index 81db3e2e7..000000000 --- a/infer/tests/frontend/cpp/ClassTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class ClassTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/cpp/frontend/types/struct.cpp"; - ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); - } - - @Test - public void whenCaptureRunStructForwardDeclareThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/cpp/frontend/types/struct_forward_declare.cpp"; - ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/cpp/ConditionalTest.java b/infer/tests/frontend/cpp/ConditionalTest.java deleted file mode 100644 index 53f03007f..000000000 --- a/infer/tests/frontend/cpp/ConditionalTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class ConditionalTest { - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/conditional/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void testInlineMethodDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("lvalue_conditional.cpp"); - } - - @Test - public void testBinaryConditionalDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("binary_conditional.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/ConstructorsTest.java b/infer/tests/frontend/cpp/ConstructorsTest.java deleted file mode 100644 index 79a763932..000000000 --- a/infer/tests/frontend/cpp/ConstructorsTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class ConstructorsTest { - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/constructors/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void testConstructorWithBodyDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("constructor_with_body.cpp"); - } - - @Test - public void testConstructorDefaultArgDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("constructor_default_arg.cpp"); - } - - @Test - public void testTempObjectDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("temp_object.cpp"); - } - - @Test - public void testConstructorInitDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("constructor_init.cpp"); - } - - @Test - public void testCopyMoveConstructorDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("copy_move_constructor.cpp"); - } - - @Test - public void testDefaultFieldInitDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("default_field_init.cpp"); - } - - @Test - public void testConstructorInitListDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("constructor_struct_init_list.cpp"); - } - - @Test - public void testStdInitListDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("std_init_list.cpp"); - } - - @Test - public void testConstructorNewFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("constructor_new.cpp"); - } - - @Test - public void testConstructorArrayFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("constructor_array.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/DestructorsTest.java b/infer/tests/frontend/cpp/DestructorsTest.java deleted file mode 100644 index ee5205055..000000000 --- a/infer/tests/frontend/cpp/DestructorsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class DestructorsTest { - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/destructors/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void testSimpleDeclDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("simple_decl.cpp"); - } - - @Test - public void testCallOnDeleteDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("call_on_delete.cpp"); - } - - @Test - public void testCallOnPseudoDestructorExprDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("pseudo_destructor_expr.cpp"); - } - - @Test - public void testCallOnCallDestructorDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("call_destructor.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/ExceptionsTest.java b/infer/tests/frontend/cpp/ExceptionsTest.java deleted file mode 100644 index d8989bb24..000000000 --- a/infer/tests/frontend/cpp/ExceptionsTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class ExceptionsTest { - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/exceptions/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void testSimpleDeclDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("Exceptions.cpp"); - } - - @Test - public void testNoExceptionExprDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("noexception.cpp"); - } - -} diff --git a/infer/tests/frontend/cpp/ForRangeLoopTest.java b/infer/tests/frontend/cpp/ForRangeLoopTest.java deleted file mode 100644 index 0f6c46f86..000000000 --- a/infer/tests/frontend/cpp/ForRangeLoopTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; -import utils.ClangFrontendUtils; -import utils.DebuggableTemporaryFolder; -import utils.InferException; - -import java.io.IOException; - -public class ForRangeLoopTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunOnForEach1ThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/cpp/frontend/loops/foreach1.cpp"; - ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/cpp/FunctionsTest.java b/infer/tests/frontend/cpp/FunctionsTest.java deleted file mode 100644 index a78f57032..000000000 --- a/infer/tests/frontend/cpp/FunctionsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class FunctionsTest { - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/types/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("functions.cpp"); - } - - - @Test - public void testOperatorDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("operator_overload.cpp"); - } - - @Test - public void testReturnStructDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("return_struct.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/GlobalConstTest.java b/infer/tests/frontend/cpp/GlobalConstTest.java deleted file mode 100644 index f3b051eb8..000000000 --- a/infer/tests/frontend/cpp/GlobalConstTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.ClangFrontendUtils; -import utils.DebuggableTemporaryFolder; -import utils.InferException; - -public class GlobalConstTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/cpp/frontend/global_const/global_const1.cpp"; - ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/cpp/GlobalConstTest2.java b/infer/tests/frontend/cpp/GlobalConstTest2.java deleted file mode 100644 index 9d92c9e21..000000000 --- a/infer/tests/frontend/cpp/GlobalConstTest2.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.ClangFrontendUtils; -import utils.DebuggableTemporaryFolder; -import utils.InferException; - -public class GlobalConstTest2 { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/cpp/frontend/global_const/global_const2.cpp"; - ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/cpp/IncludeHeaderTest.java b/infer/tests/frontend/cpp/IncludeHeaderTest.java deleted file mode 100644 index 46ecf33c3..000000000 --- a/infer/tests/frontend/cpp/IncludeHeaderTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class IncludeHeaderTest { - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/include_header/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFilesIncludeHeaders(folder, basePath + fileRelative); - } - - @Test - public void testIncludeOnlyDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("include_only.cpp"); - } - - @Test - public void testIncludeTemplDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("include_templ.cpp"); - } - -} diff --git a/infer/tests/frontend/cpp/InheritanceTest.java b/infer/tests/frontend/cpp/InheritanceTest.java deleted file mode 100644 index 892174e0b..000000000 --- a/infer/tests/frontend/cpp/InheritanceTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class InheritanceTest { - - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/types/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void testInheritanceDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("inheritance.cpp"); - } - - @Test - public void testInheritanceFieldDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("inheritance_field.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/LiteralsTest.java b/infer/tests/frontend/cpp/LiteralsTest.java deleted file mode 100644 index eded6bb9e..000000000 --- a/infer/tests/frontend/cpp/LiteralsTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class LiteralsTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunNullptrThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/cpp/frontend/literals/nullptr.cpp"; - ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); - } - - @Test - public void whenCaptureRunScalarValueInitThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/cpp/frontend/literals/scalar_value_init.cpp"; - ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/cpp/MethodsTest.java b/infer/tests/frontend/cpp/MethodsTest.java deleted file mode 100644 index 746207bde..000000000 --- a/infer/tests/frontend/cpp/MethodsTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class MethodsTest { - - String methodBasePath = "infer/tests/codetoanalyze/cpp/frontend/methods/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, methodBasePath + fileRelative); - } - - @Test - public void testInlineMethodDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("inline_method.cpp"); - } - - @Test - public void testDefaultParametersDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("default_parameters.cpp"); - } - - @Test - public void testOverloadingDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("overloading.cpp"); - } - - @Test - public void testDerefernceThisDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("dereference_this.cpp"); - } - - @Test - public void testStaticDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("static.cpp"); - } - - @Test - public void testReturnStructDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("return_struct.cpp"); - } - - @Test - public void testConversionOperatorDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("conversion_operator.cpp"); - } - - @Test - public void testVirtualMethodsDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("virtual_methods.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/NPETest.java b/infer/tests/frontend/cpp/NPETest.java deleted file mode 100644 index 1518d6592..000000000 --- a/infer/tests/frontend/cpp/NPETest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.ClangFrontendUtils; -import utils.DebuggableTemporaryFolder; -import utils.InferException; - -public class NPETest { - - - String methodBasePath = "infer/tests/codetoanalyze/cpp/errors/npe/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, methodBasePath + fileRelative); - } - - @Test - public void testInlineMethodDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("method_call.cpp"); - } - - - -} diff --git a/infer/tests/frontend/cpp/NamespaceTest.java b/infer/tests/frontend/cpp/NamespaceTest.java deleted file mode 100644 index 7adcd853e..000000000 --- a/infer/tests/frontend/cpp/NamespaceTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class NamespaceTest { - String basePath = "infer/tests/codetoanalyze/cpp/frontend/namespace/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void testNamespaceDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("namespace.cpp"); - } - - @Test - public void testFunctionDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("function.cpp"); - } - - @Test - public void testGlobalVariableDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("global_variable.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/NestedCPPOperatorsTest.java b/infer/tests/frontend/cpp/NestedCPPOperatorsTest.java deleted file mode 100644 index 19b86cd0d..000000000 --- a/infer/tests/frontend/cpp/NestedCPPOperatorsTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class NestedCPPOperatorsTest { - - String nestedOperatorsBasePath = "infer/tests/codetoanalyze/cpp/frontend/nestedoperators/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, nestedOperatorsBasePath + fileRelative); - } - - - @Test - public void testVarDeclInsideIfDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("var_decl_inside_if.cpp"); - } - - @Test - public void testVarDeclInsideWhileDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("var_decl_inside_while.cpp"); - } - - @Test - public void testVarDeclInsideForDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("var_decl_inside_for.cpp"); - } - - @Test - public void testVarDeclInsideSwitchDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("var_decl_inside_switch.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/NestedOperatorsTest.java b/infer/tests/frontend/cpp/NestedOperatorsTest.java deleted file mode 100644 index 15c86a06d..000000000 --- a/infer/tests/frontend/cpp/NestedOperatorsTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -/** - * Run C++ frontend on C code and compare it to .dot files produced by C frontend. - */ -public class NestedOperatorsTest { - - String nestedOperatorsBasePath = "infer/tests/codetoanalyze/c/frontend/nestedoperators/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, nestedOperatorsBasePath + fileRelative); - } - - - @Test - public void whenCaptureRunEnumThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - frontendTest("nestedassignment.c"); - } - - @Test - public void whenCaptureRunUnionThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - // .dot file for cpp is different due to autogenerated constructors for union type - // otherwise cfgs should look the same for C and C++ - frontendTest("union.cpp"); - } - - @Test - public void whenCaptureRunAssignInConditionThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - // .dot file for cpp is slightly different (but semantically equivalent). - // We need to have different dot file to compare against. - // assign_in_condition.cpp is in fact pointing to assign_in_condition.c - frontendTest("assign_in_condition.cpp"); - } - - @Test - public void whenCaptureRunAssignWithIncrementThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - // .dot file differs, but it's semantically equivalent to one produced by - // C compiler - frontendTest("assign_with_increment.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/NewTest.java b/infer/tests/frontend/cpp/NewTest.java deleted file mode 100644 index 279fe26b2..000000000 --- a/infer/tests/frontend/cpp/NewTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class NewTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/cpp/frontend/builtin/new.cpp"; - ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/cpp/ReferenceTest.java b/infer/tests/frontend/cpp/ReferenceTest.java deleted file mode 100644 index ede6ef3bf..000000000 --- a/infer/tests/frontend/cpp/ReferenceTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2015 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class ReferenceTest { - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/reference/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void testBoxDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("box.cpp"); - } - - @Test - public void testUnboxDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("unbox.cpp"); - } - - @Test - public void testInitDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("init.cpp"); - } - - @Test - public void testMemberAccessDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("member_access.cpp"); - } - - @Test - public void testMemberAccessFromReturnDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("member_access_from_return.cpp"); - } - - @Test - public void testNestedAssignmentDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("nested_assignment.cpp"); - } - - @Test - public void testIncrementDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("increment.cpp"); - } - - @Test - public void testTemporaryLValueDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("temporary_lvalue.cpp"); - } - - @Test - public void testReferenceTypeE2EDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("reference_type_e2e.cpp"); - } - - @Test - public void testReferenceStructE2EDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("reference_struct_e2e.cpp"); - } - - @Test - public void testReferenceFieldDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("reference_field.cpp"); - } - -} diff --git a/infer/tests/frontend/cpp/SelfParameterTest.java b/infer/tests/frontend/cpp/SelfParameterTest.java deleted file mode 100644 index d53df3135..000000000 --- a/infer/tests/frontend/cpp/SelfParameterTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class SelfParameterTest { - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - @Test - public void whenCaptureRunCommaThenDotFilesAreTheSame() - throws InterruptedException, IOException, InferException { - String src = - "infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.cpp"; - ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); - } -} diff --git a/infer/tests/frontend/cpp/SubtypingTest.java b/infer/tests/frontend/cpp/SubtypingTest.java deleted file mode 100644 index 0db573084..000000000 --- a/infer/tests/frontend/cpp/SubtypingTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class SubtypingTest { - - String basePath = "infer/tests/codetoanalyze/cpp/errors/subtyping/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void testSimpleDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("cast_with_enforce.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/TemplatesTest.java b/infer/tests/frontend/cpp/TemplatesTest.java deleted file mode 100644 index 76f9b8523..000000000 --- a/infer/tests/frontend/cpp/TemplatesTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class TemplatesTest { - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/templates/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void testSimpleDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("simple.cpp"); - } - - @Test - public void testClassTemplateInstantiateDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("class_template_instantiate.cpp"); - } - - @Test - public void testFunctionDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("function.cpp"); - } - - @Test - public void testMethodDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("method.cpp"); - } - - @Test - public void testSizeofPackDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("sizeof_pack.cpp"); - } - - - @Test - public void testFunctionPackDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("function_pack.cpp"); - } -} diff --git a/infer/tests/frontend/cpp/TypesTest.java b/infer/tests/frontend/cpp/TypesTest.java deleted file mode 100644 index 68b58df8d..000000000 --- a/infer/tests/frontend/cpp/TypesTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package frontend.cpp; - -import org.junit.Rule; -import org.junit.Test; - -import java.io.IOException; - -import utils.DebuggableTemporaryFolder; -import utils.InferException; -import utils.ClangFrontendUtils; - -public class TypesTest { - - String basePath = "infer/tests/codetoanalyze/cpp/frontend/types/"; - - @Rule - public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - - void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { - ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative); - } - - @Test - public void typeidExprDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("typeid_expr.cpp"); - } - - @Test - public void structPassByValueDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("struct_pass_by_value.cpp"); - } - - @Test - public void typeTraitExprDotFilesMatch() - throws InterruptedException, IOException, InferException { - frontendTest("type_trait_expr.cpp"); - } -}