[PATCH] D109794: [Sanitizer] Allow setting the report path to create directory

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 20 08:59:45 PDT 2021


vitalybuka added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_common.h:263
 
+#if !SANITIZER_FUCHSIA
+int CreateDir(const char *pathname);
----------------
vitalybuka wrote:
> tejohnson wrote:
> > vitalybuka wrote:
> > > can we avoid #if?
> > > we don't have one e.g. for GetProcessName
> > GetProcessName has a single def in sanitizer_common.cpp. A closer analogy would be Abort(), which has implementations in all of these 4 places:
> > sanitizer_posix_libcdep.cpp
> > sanitizer_common_nolibc.cpp
> > sanitizer_win.cpp
> > sanitizer_fuchsia.cpp
> > 
> > Since CreateDir calls mkdir/_mkdir it also needs to be defined in similar places, and I have defs in the first 3 of the above. I believe for things to link properly on Fuchsia I would need to provide one there too. However, sanitizer_file.cpp which uses this new function has its code entirely guarded by #if !SANITIZER_FUCHSIA, so I wasn't sure it made sense. WDYT?
> I guess you can just move CreateDir next to IsPathSeparator into sanitizer_file.h without any defines. That header is better place for the definition anyway. 
"without any defines" -> "without any  ifdefs"


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109794/new/

https://reviews.llvm.org/D109794



More information about the llvm-commits mailing list