Replace wpi::errs() usage with fmtlib (#5560)

This will make migration to C++23's std::print() easier later.

Fixes #5556.
This commit is contained in:
Tyler Veness
2023-08-29 08:56:07 -07:00
committed by GitHub
parent ab3bf39e0e
commit d7264ff597
2 changed files with 29 additions and 21 deletions

View File

@@ -15,6 +15,8 @@
#include <utility>
#include <vector>
#include <fmt/core.h>
#include "wpi/ConvertUTF.h"
#include "wpi/SafeThread.h"
#include "wpi/SmallString.h"
@@ -158,8 +160,8 @@ class JStringRef {
env->ReleaseStringCritical(str, chars);
}
} else {
errs() << "JStringRef was passed a null pointer at \n"
<< GetJavaStackTrace(env);
fmt::print(stderr, "JStringRef was passed a null pointer at\n",
GetJavaStackTrace(env));
}
// Ensure str is null-terminated.
m_str.push_back('\0');
@@ -281,8 +283,8 @@ class JSpanBase {
m_elements{static_cast<std::remove_cv_t<T>*>(
bb ? env->GetDirectBufferAddress(bb) : nullptr)} {
if (!bb) {
errs() << "JSpan was passed a null pointer at \n"
<< GetJavaStackTrace(env);
fmt::print(stderr, "JSpan was passed a null pointer at\n",
GetJavaStackTrace(env));
}
}
@@ -300,8 +302,8 @@ class JSpanBase {
m_elements = ArrHelper::GetArrayElements(env, jarr);
}
} else {
errs() << "JSpan was passed a null pointer at \n"
<< GetJavaStackTrace(env);
fmt::print(stderr, "JSpan was passed a null pointer at\n",
GetJavaStackTrace(env));
}
}