[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
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 36a5dc33ee
commit c45afc9859

@ -36,8 +36,6 @@ def string_in_quotes(value):
return value.strip('\'') 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): def create_argparser(group_name=MODULE_NAME):
"""This defines the set of arguments that get added by this module to the """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 set of global args defined in the infer top-level module

@ -35,8 +35,9 @@ def gen_instance(*args):
return MakeCapture(*args) return MakeCapture(*args)
create_argparser = \ # This creates an empty argparser for the module, which provides only
util.clang_frontend_argparser(MODULE_DESCRIPTION, MODULE_NAME) # description/usage information and no arguments.
create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME)
class MakeCapture: class MakeCapture:

@ -20,8 +20,7 @@ def gen_instance(*args):
return NdkBuildCapture(*args) return NdkBuildCapture(*args)
create_argparser = \ create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME)
util.clang_frontend_argparser(MODULE_DESCRIPTION, MODULE_NAME)
class NdkBuildCapture(make.MakeCapture): class NdkBuildCapture(make.MakeCapture):

@ -71,56 +71,6 @@ def base_argparser(description, module_name):
return _func 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): def get_clang_frontend_envvars(args):
"""Return the environment variables that configure the clang wrapper, e.g. """Return the environment variables that configure the clang wrapper, e.g.
to emit debug information if needed, and the invocation of the Infer to emit debug information if needed, and the invocation of the Infer

@ -31,8 +31,7 @@ CLANGPLUSPLUS_WRAPPER = os.path.join(config.XCODE_WRAPPERS_DIRECTORY,
def gen_instance(*args): def gen_instance(*args):
return XcodebuildCapture(*args) return XcodebuildCapture(*args)
create_argparser = \ create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME)
util.clang_frontend_argparser(MODULE_DESCRIPTION, MODULE_NAME)
class XcodebuildCapture: class XcodebuildCapture:

@ -11,13 +11,6 @@ open! Utils
(** Top-level driver that orchestrates build system integration, frontends, and backend *) (** 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 *) (** as the Config.fail_on_bug flag mandates, exit with error when an issue is reported *)
let fail_on_issue_epilogue () = let fail_on_issue_epilogue () =
let issues_json = DB.Results_dir.(path_to_filename Abs_root ["report.json"]) in let issues_json = DB.Results_dir.(path_to_filename Abs_root ["report.json"]) in
@ -28,7 +21,6 @@ let fail_on_issue_epilogue () =
| None -> () | None -> ()
let () = let () =
set_env_for_clang_wrapper () ;
let infer_py = Config.lib_dir // "python" // "infer.py" in let infer_py = Config.lib_dir // "python" // "infer.py" in
let build_cmd = IList.rev Config.rest in let build_cmd = IList.rev Config.rest in
let in_buck_mode = match build_cmd with "buck" :: _ -> true | _ -> false in let in_buck_mode = match build_cmd with "buck" :: _ -> true | _ -> false in
@ -62,10 +54,6 @@ let () =
["--debug-exceptions"]) @ ["--debug-exceptions"]) @
(if Config.filtering then [] else (if Config.filtering then [] else
["--no-filtering"]) @ ["--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 (if not Config.flavors || not in_buck_mode then [] else
["--use-flavors"]) @ ["--use-flavors"]) @
(if Option.is_none Config.use_compilation_database || not in_buck_mode then [] else (if Option.is_none Config.use_compilation_database || not in_buck_mode then [] else

Loading…
Cancel
Save