[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:09:57 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)";
+ };
Printf("%s", decorator.Error());
- Report("ERROR: RealtimeSanitizer: %s\n", violation_type);
+ Report("ERROR: RealtimeSanitizer: %s\n", error_type_str());
}
static void PrintReason(const Decorator &decorator,
- const DiagnosticsCallerInfo &info) {
+ const DiagnosticsInfo &info) {
Printf("%s", decorator.Reason());
- std::visit(
- Overloaded{[decorator](const InterceptedCallInfo &call) {
- Printf("Intercepted call to real-time unsafe function "
- "`%s%s%s` in real-time context!",
- decorator.FunctionName(),
- call.intercepted_function_name_, decorator.Reason());
- },
- [decorator](const BlockingCallInfo &arg) {
- Printf("Call to blocking function "
- "`%s%s%s` in real-time context!",
- decorator.FunctionName(), arg.blocking_function_name_,
- decorator.Reason());
- }},
- info);
+ switch (info.type) {
+ case DiagnosticsInfoType::InterceptedCall: {
+ Printf("Intercepted call to real-time unsafe function "
+ "`%s%s%s` in real-time context!",
+ decorator.FunctionName(), info.func_name, decorator.Reason());
+ break;
+ }
+ case DiagnosticsInfoType::BlockingCall: {
+ Printf("Call to blocking function "
+ "`%s%s%s` in real-time context!",
+ decorator.FunctionName(), info.func_name, decorator.Reason());
+ break;
+ }
+ }
----------------
cjappl wrote:
Strange styling here, but I presume it is what clang-format spit out
https://github.com/llvm/llvm-project/pull/109786
More information about the llvm-commits
mailing list