[clang] fix: replace report_fatal_error with Diags and exit (PR #147959)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 23 05:18:20 PDT 2025


================
@@ -1697,6 +1698,15 @@ ASTContext::getRelocationInfoForCXXRecord(const CXXRecordDecl *RD) const {
   return std::nullopt;
 }
 
+void ASTContext::initSanitizers(const LangOptions &LangOpts,
+                                SourceManager &SM) {
+  std::string Error;
+  if (!NoSanitizeL->init(LangOpts.NoSanitizeFiles, Error)) {
+    const std::string &Path = LangOpts.NoSanitizeFiles.front();
----------------
AaronBallman wrote:

Almost! You can split the diagnostics up if that's easier for you, but another approach would be:
```
def err_no_sanitize_file_failure : Error<
  "failed to %select{load|parse}0 sanitizer ignorelist file '%1'">;
```
where you only have a single diagnostic but pass in an argument to switch between `load` and `parse`.

Note, you don't need:

> `def SanitizeIgnorelist : DiagGroup<"sanitize-ignorelist">;`

because diagnostic groups are only for warnings, and you're producing errors.

https://github.com/llvm/llvm-project/pull/147959


More information about the cfe-commits mailing list