summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/profile/InstrProfilingFile.c2
-rw-r--r--compiler-rt/lib/profile/InstrProfilingUtil.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index 2f24f004f95..9d63269eb25 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -79,7 +79,7 @@ static void truncateCurrentFile(void) {
return;
/* Create the directory holding the file, if needed. */
- if (strchr(Filename, '/')) {
+ if (strchr(Filename, '/') || strchr(Filename, '\\')) {
char *Copy = malloc(strlen(Filename) + 1);
strcpy(Copy, Filename);
__llvm_profile_recursive_mkdir(Copy);
diff --git a/compiler-rt/lib/profile/InstrProfilingUtil.c b/compiler-rt/lib/profile/InstrProfilingUtil.c
index 535998433b9..04bdb3e4c98 100644
--- a/compiler-rt/lib/profile/InstrProfilingUtil.c
+++ b/compiler-rt/lib/profile/InstrProfilingUtil.c
@@ -28,14 +28,16 @@ void __llvm_profile_recursive_mkdir(char *path) {
int i;
for (i = 1; path[i] != '\0'; ++i) {
- if (path[i] != '/') continue;
+ char save = path[i];
+ if (!(path[i] == '/' || path[i] == '\\'))
+ continue;
path[i] = '\0';
#ifdef _WIN32
_mkdir(path);
#else
mkdir(path, 0755); /* Some of these will fail, ignore it. */
#endif
- path[i] = '/';
+ path[i] = save;
}
}
OpenPOWER on IntegriCloud