1 /*===- InstrProfilingUtil.c - Support library for PGO instrumentation -----===*\ 2 |* 3 |* The LLVM Compiler Infrastructure 4 |* 5 |* This file is distributed under the University of Illinois Open Source 6 |* License. See LICENSE.TXT for details. 7 |* 8 \*===----------------------------------------------------------------------===*/ 9 10 #include "InstrProfilingUtil.h" 11 12 #ifdef _WIN32 13 #include <direct.h> 14 #elif I386_FREEBSD 15 int mkdir(const char*, unsigned short); 16 #else 17 #include <sys/stat.h> 18 #include <sys/types.h> 19 #endif 20 21 __attribute__((visibility("hidden"))) 22 void __llvm_profile_recursive_mkdir(char *path) { 23 int i; 24 25 for (i = 1; path[i] != '\0'; ++i) { 26 if (path[i] != '/') continue; 27 path[i] = '\0'; 28 #ifdef _WIN32 29 _mkdir(path); 30 #else 31 mkdir(path, 0755); /* Some of these will fail, ignore it. */ 32 #endif 33 path[i] = '/'; 34 } 35 } 36