================
@@ -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:

> 1.The %select logic is essentially string formatting and can be handled 
> downstream where the error message is constructed.

Wellllll kind of yes but also kind of no. We try to avoid tying together 
strings like that because there are downstreams which want to localize 
diagnostic messages (and we'd like to someday do the same upstream). It's 
easier for localizers to handle `%select` for any various languages instead of 
having to try to reword diagnostics so that they still make sense with 
arbitrary string concatenation. So it works but we prefer `%select` whenever 
possible.

> 2.Changing SpecialCaseList::createInternal to propagate structured error info 
> adds unnecessary complexity, especially given its general-purpose nature.

We currently have to thread through the error string, the suggestion is to use 
an enumeration as well as a string. e.g., 
`"failed to %enum_select<SpecialCaseListFailure>{%Open{open}|%Parse{parse}}0 
sanitizer ignorelist file: %1">;` as the diagnostic message, and then use 
`std::pair<unsigned, std::string>` for passing the diagnostic information 
around, where the first parameter would be something like: 
`diag::SpecialCaseListFailure::Open`. So when you go to emit the diagnostic, it 
would effectively be: `Diag(Loc, diag::err_no_sanitize_file_failure) << 
Error.first << Error.second;`


https://github.com/llvm/llvm-project/pull/147959
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to