[PATCH] D27912: [XRay] [compiler-rt] Include argv[0] in the log file name.
Dean Michael Berris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 18 22:19:47 PST 2016
dberris requested changes to this revision.
dberris added inline comments.
This revision now requires changes to proceed.
================
Comment at: lib/xray/xray_inmemory_log.cc:116
+ auto Argv = GetArgv();
+ const char *Progname = Argv[0] == nullptr ? "UNKNOWN_PROGNAME" : Argv[0];
+ const char *LastSlash = internal_strrchr(Progname, '/');
----------------
How about instead of "UNKNOWN_PROGNAME" just 'unknown'?
================
Comment at: lib/xray/xray_inmemory_log.cc:121
+ Progname = LastSlash + 1;
+ }
+
----------------
No braces for one-liners?
================
Comment at: lib/xray/xray_inmemory_log.cc:124-125
+ int Need = internal_snprintf(TmpFilename, sizeof(TmpFilename), "%.*s%.*s.%s",
+ 120, flags()->xray_logfile_base,
+ 120, Progname,
+ TmpWildcardPattern);
----------------
What's the 120?
================
Comment at: lib/xray/xray_inmemory_log.cc:127
+ TmpWildcardPattern);
+ if (Need > int(sizeof(TmpFilename))) {
+ Report("XRay log file name too long (%d): %s\n", Need, TmpFilename);
----------------
Is there a better name than "Need"? How about Overflow?
https://reviews.llvm.org/D27912
More information about the llvm-commits
mailing list