[compiler-rt] [rtsan] Remove std::variant from rtsan diagnostics (PR #109786)

Chris Apple via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 06:12:08 PDT 2024


================
@@ -53,35 +47,39 @@ static void PrintStackTrace(uptr pc, uptr bp) {
 }
 
 static void PrintError(const Decorator &decorator,
-                       const DiagnosticsCallerInfo &info) {
-  const char *violation_type = std::visit(
-      Overloaded{
-          [](const InterceptedCallInfo &) { return "unsafe-library-call"; },
-          [](const BlockingCallInfo &) { return "blocking-call"; }},
-      info);
+                       const DiagnosticsInfo &info) {
+  const auto error_type_str = [&info]() -> const char * {
+    switch (info.type) {
+    case DiagnosticsInfoType::InterceptedCall:
+      return "unsafe-library-call";
+    case DiagnosticsInfoType::BlockingCall:
+      return "blocking-call";
+    }
+    return "(unknown error)";
----------------
cjappl wrote:

Do we want to assert or similar? I don't think this should ever happen

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


More information about the llvm-commits mailing list