Coverage Report

Created: 2021-01-19 06:58

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/tools/libclang/FatalErrorHandler.cpp
Line
Count
Source (jump to first uncovered line)
1
/*===-- clang-c/FatalErrorHandler.cpp - Fatal Error Handling ------*- C -*-===*\
2
|*                                                                            *|
3
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
4
|* Exceptions.                                                                *|
5
|* See https://llvm.org/LICENSE.txt for license information.                  *|
6
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
7
|*                                                                            *|
8
\*===----------------------------------------------------------------------===*/
9
10
#include "clang-c/FatalErrorHandler.h"
11
#include "llvm/Support/ErrorHandling.h"
12
#include <stdlib.h>
13
14
static void aborting_fatal_error_handler(void *, const std::string &reason,
15
0
                                         bool) {
16
  // Write the result out to stderr avoiding errs() because raw_ostreams can
17
  // call report_fatal_error.
18
0
  fprintf(stderr, "LIBCLANG FATAL ERROR: %s\n", reason.c_str());
19
0
  ::abort();
20
0
}
21
22
extern "C" {
23
1.05k
void clang_install_aborting_llvm_fatal_error_handler(void) {
24
1.05k
  llvm::remove_fatal_error_handler();
25
1.05k
  llvm::install_fatal_error_handler(aborting_fatal_error_handler, nullptr);
26
1.05k
}
27
28
1
void clang_uninstall_llvm_fatal_error_handler(void) {
29
1
  llvm::remove_fatal_error_handler();
30
1
}
31
}