[compiler-rt] r334267 - [XRay][compiler-rt] Cleanup some internal XRay utilities
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 8 00:48:03 PDT 2018
Author: dberris
Date: Fri Jun 8 00:48:03 2018
New Revision: 334267
URL: http://llvm.org/viewvc/llvm-project?rev=334267&view=rev
Log:
[XRay][compiler-rt] Cleanup some internal XRay utilities
This change uses 'const' for the retryingWriteAll(...) API and removes
unnecessary 'static' local variables in getting the temporary filename.
Modified:
compiler-rt/trunk/lib/xray/xray_utils.cc
compiler-rt/trunk/lib/xray/xray_utils.h
Modified: compiler-rt/trunk/lib/xray/xray_utils.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_utils.cc?rev=334267&r1=334266&r2=334267&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_utils.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_utils.cc Fri Jun 8 00:48:03 2018
@@ -15,11 +15,11 @@
#include "sanitizer_common/sanitizer_common.h"
#include "xray_defs.h"
#include "xray_flags.h"
-#include <stdlib.h>
#include <cstdio>
#include <errno.h>
#include <fcntl.h>
#include <iterator>
+#include <stdlib.h>
#include <sys/types.h>
#include <tuple>
#include <unistd.h>
@@ -31,7 +31,7 @@ void printToStdErr(const char *Buffer) X
fprintf(stderr, "%s", Buffer);
}
-void retryingWriteAll(int Fd, char *Begin, char *End) XRAY_NEVER_INSTRUMENT {
+void retryingWriteAll(int Fd, const char *Begin, const char *End) XRAY_NEVER_INSTRUMENT {
if (Begin == End)
return;
auto TotalBytes = std::distance(Begin, End);
@@ -94,10 +94,10 @@ bool readValueFromFile(const char *Filen
int getLogFD() XRAY_NEVER_INSTRUMENT {
// Open a temporary file once for the log.
- static char TmpFilename[256] = {};
- static char TmpWildcardPattern[] = "XXXXXX";
- auto Argv = GetArgv();
- const char *Progname = Argv[0] == nullptr ? "(unknown)" : Argv[0];
+ char TmpFilename[256] = {};
+ char TmpWildcardPattern[] = "XXXXXX";
+ auto **Argv = GetArgv();
+ const char *Progname = !Argv ? "(unknown)" : Argv[0];
const char *LastSlash = internal_strrchr(Progname, '/');
if (LastSlash != nullptr)
Modified: compiler-rt/trunk/lib/xray/xray_utils.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_utils.h?rev=334267&r1=334266&r2=334267&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_utils.h (original)
+++ compiler-rt/trunk/lib/xray/xray_utils.h Fri Jun 8 00:48:03 2018
@@ -24,7 +24,7 @@ namespace __xray {
void printToStdErr(const char *Buffer);
// EINTR-safe write routine, provided a file descriptor and a character range.
-void retryingWriteAll(int Fd, char *Begin, char *End);
+void retryingWriteAll(int Fd, const char *Begin, const char *End);
// Reads a long long value from a provided file.
bool readValueFromFile(const char *Filename, long long *Value);
More information about the llvm-commits
mailing list