Exemple #1
0
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))
Exemple #2
0
def compilations(exec_calls, cc, cxx):
    # type: (Iterable[Execution], str, str) -> Iterable[Compilation]
    """ 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 compilation in Compilation.iter_from_execution(call, cc, cxx):
            yield compilation
Exemple #3
0
def compilations(exec_calls, cc, cxx):
    # type: (Iterable[Execution], str, str) -> Iterable[Compilation]
    """ 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 compilation in Compilation.iter_from_execution(call, cc, cxx):
            yield compilation
Exemple #4
0
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))