[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).

llvm-svn: 264665
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index 2f24f00..9d63269 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -79,7 +79,7 @@
     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 5359984..04bdb3e 100644
--- a/compiler-rt/lib/profile/InstrProfilingUtil.c
+++ b/compiler-rt/lib/profile/InstrProfilingUtil.c
@@ -28,14 +28,16 @@
   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;
   }
 }