diff --git a/infer/src/backend/cluster.ml b/infer/src/backend/cluster.ml index 0044a69ed..913c11c48 100644 --- a/infer/src/backend/cluster.ml +++ b/infer/src/backend/cluster.ml @@ -37,7 +37,7 @@ let cl_file n = "x" ^ (cl_name n) ^ ".cluster" let pp_cluster_name fmt n = Format.fprintf fmt "%s" (cl_name n) let pp_cluster fmt (nr, cluster) = - let fname = Config.results_dir // Config.multicore_dir_name // cl_file nr in + let fname = Config.results_dir ^/ Config.multicore_dir_name ^/ cl_file nr in let pp_cl fmt n = Format.fprintf fmt "%s" (cl_name n) in store_to_file (DB.filename_from_string fname) (nr, cluster); F.fprintf fmt "%a: @\n" pp_cl nr; diff --git a/infer/src/backend/clusterMakefile.ml b/infer/src/backend/clusterMakefile.ml index aef233aea..3b9dab2e8 100644 --- a/infer/src/backend/clusterMakefile.ml +++ b/infer/src/backend/clusterMakefile.ml @@ -42,7 +42,7 @@ let pp_prolog fmt clusters = IList.map (F.sprintf "--clang-compilation-db-files %s") !Config.clang_compilation_db_files |> String.concat ~sep:" " in F.fprintf fmt "INFERANALYZE= %s -results_dir '%s' %s \n@." - (Config.bin_dir // (CLOpt.exe_name Analyze)) + (Config.bin_dir ^/ (CLOpt.exe_name Analyze)) (Escape.escape_map (fun c -> if c = '#' then Some "\\#" else None) Config.results_dir) diff --git a/infer/src/backend/crashcontext.ml b/infer/src/backend/crashcontext.ml index 991a65003..ebe69e2a7 100644 --- a/infer/src/backend/crashcontext.ml +++ b/infer/src/backend/crashcontext.ml @@ -82,9 +82,9 @@ let collect_all_summaries root_summaries_dir stacktrace_file stacktraces_dir = let pair_for_stacktrace_file = match stacktrace_file with | None -> None | Some file -> - let crashcontext_dir = Config.results_dir // "crashcontext" in + let crashcontext_dir = Config.results_dir ^/ "crashcontext" in Utils.create_dir crashcontext_dir; - Some (file, crashcontext_dir // "crashcontext.json") in + Some (file, crashcontext_dir ^/ "crashcontext.json") in let trace_file_regexp = Str.regexp "\\(.*\\)\\.json" in let pairs_for_stactrace_dir = match stacktraces_dir with | None -> [] @@ -124,7 +124,7 @@ let crashcontext_epilogue ~in_buck_mode = let buck_out = match Config.buck_out with | Some dir -> dir | None -> "buck-out" in - Config.project_root // buck_out + Config.project_root ^/ buck_out end else Config.results_dir in collect_all_summaries diff --git a/infer/src/backend/infer.ml b/infer/src/backend/infer.ml index 92da57758..87ccafe92 100644 --- a/infer/src/backend/infer.ml +++ b/infer/src/backend/infer.ml @@ -23,7 +23,7 @@ let rec rmtree name = match Unix.readdir dir with | entry -> if not (entry = Filename.current_dir_name || entry = Filename.parent_dir_name) then ( - rmtree (name // entry) + rmtree (name ^/ entry) ); rmdir dir | exception End_of_file -> @@ -76,8 +76,8 @@ let remove_results_dir () = rmtree Config.results_dir let create_results_dir () = - Unix.mkdir_p (Config.results_dir // Config.captured_dir_name) ; - Unix.mkdir_p (Config.results_dir // Config.specs_dir_name) + Unix.mkdir_p (Config.results_dir ^/ Config.captured_dir_name) ; + Unix.mkdir_p (Config.results_dir ^/ Config.specs_dir_name) let clean_results_dir () = let dirs = ["classnames"; "filelists"; "multicore"; "sources"] in @@ -89,10 +89,10 @@ let clean_results_dir () = match Unix.readdir dir with | entry -> if (IList.exists (String.equal entry) dirs) then ( - rmtree (name // entry) + rmtree (name ^/ entry) ) else if not (entry = Filename.current_dir_name || entry = Filename.parent_dir_name) then ( - clean (name // entry) + clean (name ^/ entry) ); cleandir dir | exception End_of_file -> @@ -116,7 +116,7 @@ let register_perf_stats_report () = let touch_start_file () = - let start = Config.results_dir // Config.start_filename in + let start = Config.results_dir ^/ Config.start_filename in let flags = Unix.O_CREAT :: Unix.O_WRONLY :: (if Config.continue_capture then [Unix.O_EXCL] else []) in (* create new file, or open existing file for writing to update modified timestamp *) @@ -170,7 +170,7 @@ let capture build_cmd = function ) | Genrule -> L.stdout "Capturing for Buck genrule compatibility...@\n"; - let infer_java = Config.bin_dir // "InferJava" in + let infer_java = Config.bin_dir ^/ "InferJava" in run_command ~prog:infer_java ~args:[] (fun _ -> ()) | Xcode when Config.xcpretty -> L.stdout "Capturing using xcpretty...@\n"; @@ -180,7 +180,7 @@ let capture build_cmd = function | build_mode -> L.stdout "Capturing in %s mode...@." (string_of_build_mode build_mode); let in_buck_mode = build_mode = Buck in - let infer_py = Config.lib_dir // "python" // "infer.py" in + let infer_py = Config.lib_dir ^/ "python" ^/ "infer.py" in run_command ~prog:infer_py ~args:( Config.anon_args @ @@ -227,11 +227,11 @@ let capture build_cmd = function ) let run_parallel_analysis () = - let multicore_dir = Config.results_dir // Config.multicore_dir_name in + let multicore_dir = Config.results_dir ^/ Config.multicore_dir_name in rmtree multicore_dir ; Unix.mkdir_p multicore_dir ; InferAnalyze.print_stdout_legend (); - InferAnalyze.main (multicore_dir // "Makefile") ; + InferAnalyze.main (multicore_dir ^/ "Makefile") ; let cwd = Unix.getcwd () in Unix.chdir multicore_dir ; run_command @@ -282,7 +282,7 @@ let analyze = function (* In Java and Javac modes, analysis is invoked from capture. *) () | Analyze | Ant | Buck | ClangCompilationDatabase | Gradle | Genrule | Make | Mvn | Ndk | Xcode -> - if (Sys.file_exists Config.(results_dir // captured_dir_name)) <> `Yes then ( + if (Sys.file_exists Config.(results_dir ^/ captured_dir_name)) <> `Yes then ( L.stderr "There was nothing to analyze, exiting" ; Config.print_usage_exit () ); diff --git a/infer/src/backend/mergeCapture.ml b/infer/src/backend/mergeCapture.ml index 41b98859d..0b8b13b34 100644 --- a/infer/src/backend/mergeCapture.ml +++ b/infer/src/backend/mergeCapture.ml @@ -188,7 +188,7 @@ let process_merge_file deps_file = | target :: _ :: target_results_dir :: _ -> let infer_out_src = if Filename.is_relative target_results_dir then - Filename.dirname (buck_out ()) // target_results_dir + Filename.dirname (buck_out ()) ^/ target_results_dir else target_results_dir in let skiplevels = 2 in (* Don't link toplevel files, definitely not .start *) if should_link ~target ~target_results_dir ~stats infer_out_src infer_out_dst diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index dd87c4347..aea7dff47 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -247,31 +247,31 @@ let bin_dir = Filename.dirname real_exe_name let lib_dir = - bin_dir // Filename.parent_dir_name // "lib" + bin_dir ^/ Filename.parent_dir_name ^/ "lib" let etc_dir = - bin_dir // Filename.parent_dir_name // "etc" + bin_dir ^/ Filename.parent_dir_name ^/ "etc" (** Path to lib/specs to retrieve the default models *) let models_dir = - lib_dir // specs_dir_name + lib_dir ^/ specs_dir_name let models_jar = - lib_dir // "java" // "models.jar" + lib_dir ^/ "java" ^/ "models.jar" let models_src_dir = - let dir = bin_dir // Filename.parent_dir_name // "models" in + let dir = bin_dir ^/ Filename.parent_dir_name ^/ "models" in Utils.filename_to_absolute dir (* Normalize the path *) -let relative_cpp_extra_include_dir = "cpp" // "include" +let relative_cpp_extra_include_dir = "cpp" ^/ "include" -let cpp_extra_include_dir = models_src_dir // relative_cpp_extra_include_dir +let cpp_extra_include_dir = models_src_dir ^/ relative_cpp_extra_include_dir let relative_cpp_models_dir = - relative_cpp_extra_include_dir // "infer_model" + relative_cpp_extra_include_dir ^/ "infer_model" let wrappers_dir = - lib_dir // "wrappers" + lib_dir ^/ "wrappers" let ncpu = try @@ -445,8 +445,8 @@ and project_root = !project_root let inferconfig_path = match inferconfig_home with - | Some dir -> dir // inferconfig_file - | None -> project_root // inferconfig_file + | Some dir -> dir ^/ inferconfig_file + | None -> project_root ^/ inferconfig_file (* Proceed to declare and parse the remaining options *) @@ -1139,7 +1139,7 @@ and report_custom_error = and report_hook = CLOpt.mk_string_opt ~long:"report-hook" - ~default:(lib_dir // "python" // "report.py") + ~default:(lib_dir ^/ "python" ^/ "report.py") ~meta:"script" "Specify a script to be executed after the analysis results are written. This script will be \ passed --issues-csv, --issues-json, --issues-txt, --issues-xml, --project-root, and \ @@ -1147,7 +1147,7 @@ and report_hook = and results_dir = CLOpt.mk_path ~deprecated:["results_dir"; "-out"] ~long:"results-dir" ~short:"o" - ~default:(init_work_dir // "infer-out") + ~default:(init_work_dir ^/ "infer-out") ~exes:CLOpt.[Toplevel;Analyze;Clang;Java;Print] ~meta:"dir" "Write results and internal files in the specified directory" @@ -1646,7 +1646,7 @@ let specs_library = let add_spec_lib specs_library filename = let basename = Filename.basename filename in let key = basename ^ Utils.string_crc_hex32 filename in - let key_dir = cache_dir // key in + let key_dir = cache_dir ^/ key in let extract_specs dest_dir filename = if Filename.check_suffix filename ".jar" then match (Unix.mkdir dest_dir ~perm:0o700) with @@ -1656,7 +1656,7 @@ let specs_library = let zip_channel = Zip.open_in filename in let entries = Zip.entries zip_channel in let extract_entry (entry : Zip.entry) = - let dest_file = dest_dir // (Filename.basename entry.filename) in + let dest_file = dest_dir ^/ (Filename.basename entry.filename) in if Filename.check_suffix entry.filename specs_files_suffix then Zip.copy_entry_to_file zip_channel entry dest_file in IList.iter extract_entry entries; diff --git a/infer/src/base/DB.ml b/infer/src/base/DB.ml index 21abe8922..634c6b664 100644 --- a/infer/src/base/DB.ml +++ b/infer/src/base/DB.ml @@ -247,7 +247,7 @@ let fold_paths_matching ~dir ~p ~init ~f = let rec paths path_list dir = Array.fold ~f:(fun acc file -> - let path = dir // file in + let path = dir ^/ file in if Sys.is_directory path = `Yes then (paths acc path) else if p path then f path acc else acc) diff --git a/infer/src/base/IStd.ml b/infer/src/base/IStd.ml index 215bbbce4..d53c89b67 100644 --- a/infer/src/base/IStd.ml +++ b/infer/src/base/IStd.ml @@ -46,5 +46,3 @@ let failwithf fmt = let invalid_argf fmt = Format.kfprintf (fun _ -> invalid_arg (Format.flush_str_formatter ())) Format.str_formatter fmt - -let ( // ) = Filename.concat diff --git a/infer/src/base/Logging.ml b/infer/src/base/Logging.ml index c2375efa4..dd0e33a20 100644 --- a/infer/src/base/Logging.ml +++ b/infer/src/base/Logging.ml @@ -48,8 +48,8 @@ let set_log_file_identifier (current_exe : CLOpt.exe) string_opt = | None -> "" ) ^ Pid.to_string (Unix.getpid ()) ^ "_" in let exe_log_dir = - let log_dir = Config.results_dir // Config.log_dir_name in - log_dir // (log_dir_of_current_exe current_exe) in + let log_dir = Config.results_dir ^/ Config.log_dir_name in + log_dir ^/ (log_dir_of_current_exe current_exe) in let fmt_chan_file name suffix = lazy ( try Unix.mkdir_p exe_log_dir ; diff --git a/infer/src/base/Utils.ml b/infer/src/base/Utils.ml index 18bcc271b..37126a967 100644 --- a/infer/src/base/Utils.ml +++ b/infer/src/base/Utils.ml @@ -121,7 +121,7 @@ module FileNormalize = struct (* concatenate a list of strings representing a path into a filename *) let rec list_to_fname base path = match path with | [] -> base - | x :: path' -> list_to_fname (base // x) path' + | x :: path' -> list_to_fname (base ^/ x) path' (* normalize a path where done_l is a reversed path from the root already normalized *) (* and todo_l is the path still to normalize *) @@ -145,7 +145,7 @@ module FileNormalize = struct let is_relative = Filename.is_relative fname in let must_normalize = fname_contains_current_parent fname in let simple_case () = - if is_relative then Unix.getcwd () // fname + if is_relative then Unix.getcwd () ^/ fname else fname in if must_normalize then begin let done_l, todo_l = @@ -189,7 +189,7 @@ let filename_to_relative root fname = String.sub s2 ~pos:(n1 + 1) ~len:(n2 - (n1 + 1)) else s2 in let norm_root = (* norm_root is root without any trailing / *) - Filename.dirname root // Filename.basename root in + Filename.dirname root ^/ Filename.basename root in let remainder = (* remove the path prefix to root including trailing / *) string_strict_subtract norm_root fname in remainder @@ -197,7 +197,7 @@ let filename_to_relative root fname = let directory_fold f init path = let collect current_dir (accu, dirs) path = - let full_path = current_dir // path in + let full_path = current_dir ^/ path in try if Sys.is_directory full_path = `Yes then (accu, full_path:: dirs) @@ -219,7 +219,7 @@ let directory_fold f init path = let directory_iter f path = let apply current_dir dirs path = - let full_path = current_dir // path in + let full_path = current_dir ^/ path in try if Sys.is_directory full_path = `Yes then full_path:: dirs diff --git a/infer/src/clang/ClangCommand.re b/infer/src/clang/ClangCommand.re index 8562ad5dc..0de6fa823 100644 --- a/infer/src/clang/ClangCommand.re +++ b/infer/src/clang/ClangCommand.re @@ -16,11 +16,11 @@ type t = { }; let fcp_dir = - Config.bin_dir /\/ Filename.parent_dir_name /\/ Filename.parent_dir_name /\/ "facebook-clang-plugins"; + Config.bin_dir ^\/ Filename.parent_dir_name ^\/ Filename.parent_dir_name ^\/ "facebook-clang-plugins"; /** path of the plugin to load in clang */ -let plugin_path = fcp_dir /\/ "libtooling" /\/ "build" /\/ "FacebookClangPlugin.dylib"; +let plugin_path = fcp_dir ^\/ "libtooling" ^\/ "build" ^\/ "FacebookClangPlugin.dylib"; /** name of the plugin to use */ @@ -92,14 +92,14 @@ let clang_cc1_cmd_sanitizer cmd => { ) { switch Config.clang_include_to_override { | Some to_replace when String.equal arg to_replace => - fcp_dir /\/ "clang" /\/ "install" /\/ "lib" /\/ "clang" /\/ "4.0.0" /\/ "include" + fcp_dir ^\/ "clang" ^\/ "install" ^\/ "lib" ^\/ "clang" ^\/ "4.0.0" ^\/ "include" | _ => arg } } else { arg }; let post_args_rev = - [] |> IList.rev_append ["-include", Config.lib_dir /\/ "clang_wrappers" /\/ "global_defines.h"] |> + [] |> IList.rev_append ["-include", Config.lib_dir ^\/ "clang_wrappers" ^\/ "global_defines.h"] |> /* Never error on warnings. Clang is often more strict than Apple's version. These arguments are appended at the end to override previous opposite settings. How it's done: suppress all the warnings, since there are no warnings, compiler can't elevate them to error diff --git a/infer/src/clang/cFrontend_checkers_main.ml b/infer/src/clang/cFrontend_checkers_main.ml index 346531078..433b8644f 100644 --- a/infer/src/clang/cFrontend_checkers_main.ml +++ b/infer/src/clang/cFrontend_checkers_main.ml @@ -108,7 +108,7 @@ let context_with_ck_set context decl_list = let store_issues source_file = let abbrev_source_file = SourceFile.encoding source_file in - let lint_issues_dir = Config.results_dir // Config.lint_issues_dir_name in + let lint_issues_dir = Config.results_dir ^/ Config.lint_issues_dir_name in Utils.create_dir lint_issues_dir; let lint_issues_file = DB.filename_from_string (Filename.concat lint_issues_dir (abbrev_source_file ^ ".issue")) in diff --git a/infer/src/clang/cFrontend_config.ml b/infer/src/clang/cFrontend_config.ml index 434ff0d7f..dea232785 100644 --- a/infer/src/clang/cFrontend_config.ml +++ b/infer/src/clang/cFrontend_config.ml @@ -40,9 +40,9 @@ let ckcomponentcontroller_cl = "CKComponentController" (** script to run our own clang *) let clang_bin xx = - Config.bin_dir // Filename.parent_dir_name // Filename.parent_dir_name // - "facebook-clang-plugins" // - "clang" // "install" // "bin" // "clang" ^ xx + Config.bin_dir ^/ Filename.parent_dir_name ^/ Filename.parent_dir_name ^/ + "facebook-clang-plugins" ^/ + "clang" ^/ "install" ^/ "bin" ^/ "clang" ^ xx let class_method = "class" let class_type = "Class" let copy = "copy" diff --git a/infer/src/clang/cTL.ml b/infer/src/clang/cTL.ml index 14681716c..985f25b78 100644 --- a/infer/src/clang/cTL.ml +++ b/infer/src/clang/cTL.ml @@ -250,10 +250,10 @@ let debug_eval_end result = let save_dotty_when_in_debug_mode source_file = match ctl_evaluation_tracker with | Some tracker -> - let dotty_dir = Config.results_dir // Config.lint_dotty_dir_name in + let dotty_dir = Config.results_dir ^/ Config.lint_dotty_dir_name in Utils.create_dir dotty_dir; let source_file_basename = Filename.basename (SourceFile.to_abs_path source_file) in - let file = dotty_dir // (source_file_basename ^ ".dot") in + let file = dotty_dir ^/ (source_file_basename ^ ".dot") in let dotty = Debug.EvaluationTracker.DottyPrinter.dotty_of_ctl_evaluation !tracker in Utils.with_file file ~f:(fun oc -> output_string oc dotty) | _ -> () diff --git a/infer/src/integration/CaptureCompilationDatabase.ml b/infer/src/integration/CaptureCompilationDatabase.ml index f762317ed..c7d3df3bd 100644 --- a/infer/src/integration/CaptureCompilationDatabase.ml +++ b/infer/src/integration/CaptureCompilationDatabase.ml @@ -59,9 +59,9 @@ let swap_command cmd = let clang = "clang" in let clangplusplus = "clang++" in if String.is_suffix ~suffix:plusplus cmd then - Config.wrappers_dir // clangplusplus + Config.wrappers_dir ^/ clangplusplus else - Config.wrappers_dir // clang + Config.wrappers_dir ^/ clang let run_compilation_file compilation_database file = try @@ -124,7 +124,7 @@ let get_compilation_database_files_buck () = (** Compute the compilation database files. *) let get_compilation_database_files_xcodebuild () = let prog_args = IList.rev Config.rest in - let temp_dir = Config.results_dir // "clang" in + let temp_dir = Config.results_dir ^/ "clang" in Utils.create_dir temp_dir; let tmp_file = Filename.temp_file ~in_dir:temp_dir "cdb" ".json" in let xcodebuild_prog, xcodebuild_args = diff --git a/infer/src/integration/ClangQuotes.re b/infer/src/integration/ClangQuotes.re index 2abdc5b3c..a081a235a 100644 --- a/infer/src/integration/ClangQuotes.re +++ b/infer/src/integration/ClangQuotes.re @@ -31,7 +31,7 @@ let quote style => }; let mk_arg_file prefix style args => { - let temp_dir = Config.results_dir /\/ "clang"; + let temp_dir = Config.results_dir ^\/ "clang"; Utils.create_dir temp_dir; let file = Filename.temp_file in_dir::temp_dir prefix ".txt"; let write_args outc =>