summaryrefslogtreecommitdiff
path: root/lib/profile/InstrProfilingUtil.c
diff options
context:
space:
mode:
authorSean Silva <chisophugis@gmail.com>2016-03-28 21:32:46 +0000
committerSean Silva <chisophugis@gmail.com>2016-03-28 21:32:46 +0000
commite49604bf3b89b528d2a7809e583da2273ed89ffd (patch)
treedea5f0addd700e28100493b2d2a8595cfb03bb91 /lib/profile/InstrProfilingUtil.c
parent6ac9f5dd961f7f3dd0564baa2d61e7dcf4af515b (diff)
[libprofile] Handle '\\' in __llvm_profile_recursive_mkdir
This is implicitly needed at least by gcc-flag-compatibility.test The thing that needs it is the `\` preceding the "default.profraw" appended internally by clang when doing `-fprofile-use=`. Clang uses `\` because is uses sys::path::append which will use `\` on a Windows host. This is wrong, but I don't think there's an easy way to solve it (maybe just always using `/` since places that accept `\` also tend to accept `/`, but not the other way around). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264665 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfilingUtil.c')
-rw-r--r--lib/profile/InstrProfilingUtil.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/profile/InstrProfilingUtil.c b/lib/profile/InstrProfilingUtil.c
index 535998433..04bdb3e4c 100644
--- a/lib/profile/InstrProfilingUtil.c
+++ b/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;
}
}