[llvm] r334841 - Avoid copying PrettyStackTrace messages an extra time on Apple OSs
Jordan Rose via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 15 09:35:31 PDT 2018
Author: jrose
Date: Fri Jun 15 09:35:31 2018
New Revision: 334841
URL: http://llvm.org/viewvc/llvm-project?rev=334841&view=rev
Log:
Avoid copying PrettyStackTrace messages an extra time on Apple OSs
We were unnecessarily going from SmallString to std::string just to
get a null-terminated C string. So just...don't do that. Crash
slightly faster!
Modified:
llvm/trunk/lib/Support/PrettyStackTrace.cpp
Modified: llvm/trunk/lib/Support/PrettyStackTrace.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PrettyStackTrace.cpp?rev=334841&r1=334840&r2=334841&view=diff
==============================================================================
--- llvm/trunk/lib/Support/PrettyStackTrace.cpp (original)
+++ llvm/trunk/lib/Support/PrettyStackTrace.cpp Fri Jun 15 09:35:31 2018
@@ -118,9 +118,9 @@ static void CrashHandler(void *) {
if (!TmpStr.empty()) {
#ifdef HAVE_CRASHREPORTERCLIENT_H
// Cast to void to avoid warning.
- (void)CRSetCrashLogMessage(std::string(TmpStr.str()).c_str());
+ (void)CRSetCrashLogMessage(TmpStr.c_str());
#elif HAVE_CRASHREPORTER_INFO
- __crashreporter_info__ = strdup(std::string(TmpStr.str()).c_str());
+ __crashreporter_info__ = strdup(TmpStr.c_str());
#endif
errs() << TmpStr.str();
}
More information about the llvm-commits
mailing list