[compiler-rt] [Sanitizer] Use % patterns in report paths (PR #141820)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Thu May 29 14:58:31 PDT 2025


================
@@ -96,12 +96,76 @@ static void RecursiveCreateParentDirs(char *path) {
   }
 }
 
+/// Parse the report path \p pattern and copy the parsed path to \p dest.
+///
+/// * `%%` becomes `%`
+/// * `%H` expands to the environment variable `HOME`
+/// * `%t` expands to the environment variable `TMPDIR`
+/// * `%p` expands to the process ID (PID)
+static void ParseAndSetPath(const char *pattern, char *dest,
+                            const uptr dest_size) {
+  CHECK(pattern);
+  CHECK(dest);
+  CHECK_GT(dest_size, 1);
----------------
ellishg wrote:

If `dest_size = 1` then that only leave space for the null byte. I guess an empty path is valid, so maybe I should allow that

https://github.com/llvm/llvm-project/pull/141820


More information about the llvm-commits mailing list