[PATCH] D65245: [profile] In Android, do not mkdir() dirs in GCOV_PREFIX

Pirama Arumuga Nainar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 14:16:55 PDT 2019


pirama marked an inline comment as done.
pirama added inline comments.


================
Comment at: compiler-rt/lib/profile/InstrProfilingUtil.c:53
+    // even attempting to stat()) top-level directories like "/data".
+    const char *gcov_prefix = getenv("GCOV_PREFIX");
+    if (gcov_prefix != NULL && strncmp(path, gcov_prefix, i) == 0)
----------------
davidxl wrote:
> getenv is repeatedly called in the loop which is not desired. Can you add a helper function and call it outside the loop to 'strip' the prefix from path?
I refactored to call getenv() just once.  I kept the special case within this function to avoiding adding #ifdef ANDROID at two different places, but happy to add if you think that'd make this function cleaner.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65245





More information about the llvm-commits mailing list