From c45afc9859862eaf57fdde9b405963bf3629ab4e Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 18 Oct 2016 02:10:41 -0700 Subject: [PATCH] [clang] cleanup obsolete python code Summary: Python isn't needed anymore to pass options between `infer` and `InferClang`. However, it is still needed to set up `PATH` so that we pick up compilation commands. Reviewed By: jberdine Differential Revision: D4008469 fbshipit-source-id: 05c5716 --- infer/lib/python/inferlib/capture/buck.py | 2 - infer/lib/python/inferlib/capture/make.py | 5 +- .../lib/python/inferlib/capture/ndk-build.py | 3 +- infer/lib/python/inferlib/capture/util.py | 50 ------------------- .../lib/python/inferlib/capture/xcodebuild.py | 3 +- infer/src/backend/infer.ml | 12 ----- 6 files changed, 5 insertions(+), 70 deletions(-) diff --git a/infer/lib/python/inferlib/capture/buck.py b/infer/lib/python/inferlib/capture/buck.py index d81e58603..eabe3c89a 100644 --- a/infer/lib/python/inferlib/capture/buck.py +++ b/infer/lib/python/inferlib/capture/buck.py @@ -36,8 +36,6 @@ def string_in_quotes(value): return value.strip('\'') -# This creates an empty argparser for the module, which provides only -# description/usage information and no arguments. def create_argparser(group_name=MODULE_NAME): """This defines the set of arguments that get added by this module to the set of global args defined in the infer top-level module diff --git a/infer/lib/python/inferlib/capture/make.py b/infer/lib/python/inferlib/capture/make.py index e728dc937..1207611cf 100644 --- a/infer/lib/python/inferlib/capture/make.py +++ b/infer/lib/python/inferlib/capture/make.py @@ -35,8 +35,9 @@ def gen_instance(*args): return MakeCapture(*args) -create_argparser = \ - util.clang_frontend_argparser(MODULE_DESCRIPTION, MODULE_NAME) +# This creates an empty argparser for the module, which provides only +# description/usage information and no arguments. +create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME) class MakeCapture: diff --git a/infer/lib/python/inferlib/capture/ndk-build.py b/infer/lib/python/inferlib/capture/ndk-build.py index 55afc0f37..50063bcd0 100644 --- a/infer/lib/python/inferlib/capture/ndk-build.py +++ b/infer/lib/python/inferlib/capture/ndk-build.py @@ -20,8 +20,7 @@ def gen_instance(*args): return NdkBuildCapture(*args) -create_argparser = \ - util.clang_frontend_argparser(MODULE_DESCRIPTION, MODULE_NAME) +create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME) class NdkBuildCapture(make.MakeCapture): diff --git a/infer/lib/python/inferlib/capture/util.py b/infer/lib/python/inferlib/capture/util.py index caa35791d..4e6403405 100644 --- a/infer/lib/python/inferlib/capture/util.py +++ b/infer/lib/python/inferlib/capture/util.py @@ -71,56 +71,6 @@ def base_argparser(description, module_name): return _func -def clang_frontend_argparser(description, module_name): - def _func(group_name=module_name): - """This creates an argparser for all the modules that require - clang for their capture phase, thus InferClang and clang wrappers""" - parser = argparse.ArgumentParser(add_help=False) - group = parser.add_argument_group( - '{grp} module'.format(grp=group_name), - description=description, - ) - group.add_argument( - '-hd', '--headers', - action='store_true', - help='Analyze code in header files', - ) - group.add_argument( - '--models_mode', - action='store_true', - dest='models_mode', - help='Mode for computing the models', - ) - group.add_argument( - '--no_failures_allowed', - action='store_true', - dest='no_failures_allowed', - help='Fail if at least one of the translations fails', - ) - group.add_argument( - '-tm', '--testing_mode', - dest='testing_mode', - action='store_true', - help='Testing mode for the translation: Do not translate headers') - group.add_argument( - '--cxx', - dest='cxx', - action='store_true', - help='Analyze C++ code, still experimental') - group.add_argument( - '-fs', '--frontend-stats', - dest='frontend_stats', - action='store_true', - help='Output statistics about the capture phase to *.o.astlog') - group.add_argument( - '-fd', '--frontend-debug', - dest='frontend_debug', - action='store_true', - help='Output debugging information to *.o.astlog during capture') - return parser - return _func - - def get_clang_frontend_envvars(args): """Return the environment variables that configure the clang wrapper, e.g. to emit debug information if needed, and the invocation of the Infer diff --git a/infer/lib/python/inferlib/capture/xcodebuild.py b/infer/lib/python/inferlib/capture/xcodebuild.py index 469a64b44..9897ef36a 100644 --- a/infer/lib/python/inferlib/capture/xcodebuild.py +++ b/infer/lib/python/inferlib/capture/xcodebuild.py @@ -31,8 +31,7 @@ CLANGPLUSPLUS_WRAPPER = os.path.join(config.XCODE_WRAPPERS_DIRECTORY, def gen_instance(*args): return XcodebuildCapture(*args) -create_argparser = \ - util.clang_frontend_argparser(MODULE_DESCRIPTION, MODULE_NAME) +create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME) class XcodebuildCapture: diff --git a/infer/src/backend/infer.ml b/infer/src/backend/infer.ml index c3ed653bf..84e376f04 100644 --- a/infer/src/backend/infer.ml +++ b/infer/src/backend/infer.ml @@ -11,13 +11,6 @@ open! Utils (** Top-level driver that orchestrates build system integration, frontends, and backend *) -let set_env_for_clang_wrapper () = - (match Config.clang_include_to_override with - | Some dir -> Unix.putenv "FCP_CLANG_INCLUDE_TO_REPLACE" dir - | None -> () - ); - () - (** as the Config.fail_on_bug flag mandates, exit with error when an issue is reported *) let fail_on_issue_epilogue () = let issues_json = DB.Results_dir.(path_to_filename Abs_root ["report.json"]) in @@ -28,7 +21,6 @@ let fail_on_issue_epilogue () = | None -> () let () = - set_env_for_clang_wrapper () ; let infer_py = Config.lib_dir // "python" // "infer.py" in let build_cmd = IList.rev Config.rest in let in_buck_mode = match build_cmd with "buck" :: _ -> true | _ -> false in @@ -62,10 +54,6 @@ let () = ["--debug-exceptions"]) @ (if Config.filtering then [] else ["--no-filtering"]) @ - (if not Config.frontend_debug then [] else - ["--frontend-debug"]) @ - (if not Config.frontend_stats then [] else - ["--frontend-stats"]) @ (if not Config.flavors || not in_buck_mode then [] else ["--use-flavors"]) @ (if Option.is_none Config.use_compilation_database || not in_buck_mode then [] else