llvm.org GIT mirror llvm / 5e436b3
Create the parent directories to place the .gcda files in if they don't exist. That's kinda weird because the .gcno files are supposed to already be there, but libgcov does this and somehow Google has managed to depend on it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130879 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 8 years ago
1 changed file(s) with 18 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2323 #include
2424 #include
2525 #include
26 #include
27 #include
2628
2729 /* #define DEBUG_GCDAPROFILING */
2830
6365 return filename;
6466 }
6567
68 static void recursive_mkdir(const char *filename) {
69 char *pathname;
70 int i, e;
71
72 for (i = 1, e = strlen(filename); i != e; ++i) {
73 if (filename[i] == '/') {
74 pathname = malloc(i + 1);
75 strncpy(pathname, filename, i);
76 pathname[i] = '\0';
77 mkdir(pathname, 0750); /* some of these will fail, ignore it. */
78 free(pathname);
79 }
80 }
81 }
82
6683 /*
6784 * --- LLVM line counter API ---
6885 */
7491 void llvm_gcda_start_file(const char *orig_filename) {
7592 char *filename;
7693 filename = mangle_filename(orig_filename);
94 recursive_mkdir(filename);
7795 output_file = fopen(filename, "wb");
7896
7997 /* gcda file, version 404*, stamp LLVM. */