Skip to content

Commit 9d3484d

Browse files
committed
fix: replace report_fatal_error with Diags and exit
1 parent b0dea47 commit 9d3484d

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

clang/include/clang/Basic/SanitizerSpecialCaseList.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
1515
#define LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
1616

17+
#include "clang/Basic/Diagnostic.h"
1718
#include "clang/Basic/LLVM.h"
1819
#include "clang/Basic/Sanitizers.h"
1920
#include "llvm/ADT/StringRef.h"
@@ -37,8 +38,8 @@ class SanitizerSpecialCaseList : public llvm::SpecialCaseList {
3738
std::string &Error);
3839

3940
static std::unique_ptr<SanitizerSpecialCaseList>
40-
createOrDie(const std::vector<std::string> &Paths,
41-
llvm::vfs::FileSystem &VFS);
41+
createOrDie(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &VFS,
42+
DiagnosticsEngine &Diags);
4243

4344
// Query ignorelisted entries if any bit in Mask matches the entry's section.
4445
bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query,

clang/lib/Basic/NoSanitizeList.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ using namespace clang;
2222
NoSanitizeList::NoSanitizeList(const std::vector<std::string> &NoSanitizePaths,
2323
SourceManager &SM)
2424
: SSCL(SanitizerSpecialCaseList::createOrDie(
25-
NoSanitizePaths, SM.getFileManager().getVirtualFileSystem())),
25+
NoSanitizePaths, SM.getFileManager().getVirtualFileSystem(),
26+
SM.getDiagnostics())),
2627
SM(SM) {}
2728

2829
NoSanitizeList::~NoSanitizeList() = default;

clang/lib/Basic/SanitizerSpecialCaseList.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,16 @@ SanitizerSpecialCaseList::create(const std::vector<std::string> &Paths,
3030

3131
std::unique_ptr<SanitizerSpecialCaseList>
3232
SanitizerSpecialCaseList::createOrDie(const std::vector<std::string> &Paths,
33-
llvm::vfs::FileSystem &VFS) {
33+
llvm::vfs::FileSystem &VFS,
34+
DiagnosticsEngine &Diags) {
3435
std::string Error;
3536
if (auto SSCL = create(Paths, VFS, Error))
3637
return SSCL;
37-
llvm::report_fatal_error(StringRef(Error));
38+
unsigned DiagID = Diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
39+
"failed to load NoSanitize file: %0");
40+
41+
Diags.Report(DiagID) << Error;
42+
exit(1);
3843
}
3944

4045
void SanitizerSpecialCaseList::createSanitizerSections() {

0 commit comments

Comments
 (0)