def compilations(exec_calls, cc, cxx): """ Needs to filter out commands which are not compiler calls. And those compiler calls shall be compilation (not pre-processing or linking) calls. Plus needs to find the source file name from the arguments. :param exec_calls: iterator of executions :param cc: user specified C compiler name :param cxx: user specified C++ compiler name :return: stream of formatted compilation database entries """ for call in exec_calls: for entry in Compilation.from_call(call, cc, cxx): yield entry
def analyze_compiler_wrapper(result, execution): """ Entry point for `analyze-cc` and `analyze-c++` compiler wrappers. """ # don't run analyzer when compilation fails. or when it's not requested. if result or not os.getenv(ENVIRONMENT_KEY): return # collect the needed parameters from environment parameters = json.loads(os.environ[ENVIRONMENT_KEY]) # don't run analyzer when the command is not a compilation. # (filtering non compilations is done by the generator.) for compilation in Compilation.iter_from_execution(execution): current = dict(compilation.as_dict(), **parameters) logging_analyzer_output(run(current))
def analyze_build_wrapper(**kwargs): """ Entry point for `analyze-cc` and `analyze-c++` compiler wrappers. """ # don't run analyzer when compilation fails. or when it's not requested. if kwargs['result'] or not os.getenv(ENVIRONMENT_KEY): return # collect the needed parameters from environment parameters = json.loads(os.environ[ENVIRONMENT_KEY]) # don't run analyzer when the command is not a compilation. # (filtering non compilations is done by the generator.) for entry in Compilation.from_call(kwargs['execution']): current = dict(entry.to_analyzer(), **parameters) logging_analyzer_output(run(current))
def compilations(exec_calls, cc, cxx): """ Needs to filter out commands which are not compiler calls. And those compiler calls shall be compilation (not pre-processing or linking) calls. Plus needs to find the source file name from the arguments. :param exec_calls: iterator of executions :param cc: user specified C compiler name :param cxx: user specified C++ compiler name :return: stream of formatted compilation database entries """ for call in exec_calls: for entry in Compilation.from_call(call, cc, cxx): yield entry
def analyze_build_wrapper(**kwargs): """ Entry point for `analyze-cc` and `analyze-c++` compiler wrappers. """ # don't run analyzer when compilation fails. or when it's not requested. if kwargs['result'] or not os.getenv(ENVIRONMENT_KEY): return # collect the needed parameters from environment parameters = json.loads(os.environ[ENVIRONMENT_KEY]) # don't run analyzer when the command is not a compilation. # (filtering non compilations is done by the generator.) for entry in Compilation.from_call(kwargs['execution']): current = dict(entry.to_analyzer(), **parameters) logging_analyzer_output(run(current))
def analyze_compiler_wrapper(result, execution): # type: (int, Execution) -> None """ Entry point for `analyze-cc` and `analyze-c++` compiler wrappers. """ # don't run analyzer when compilation fails. or when it's not requested. if result or not os.getenv(ENVIRONMENT_KEY): return # collect the needed parameters from environment parameters = json.loads(os.environ[ENVIRONMENT_KEY]) # don't run analyzer when the command is not a compilation. # (filtering non compilations is done by the generator.) for compilation in Compilation.iter_from_execution(execution): current = dict(compilation.as_dict(), **parameters) logging_analyzer_output(run(current))
def entry_map(entry: Compilation): json_entry = entry.as_db_entry() json_entry['arguments'][ 0] = 'clang' if entry.compiler == 'cc' else 'clang++' return json_entry