Home | History | Annotate | Download | only in profile

Lines Matching defs:Filename

74   const char *Filename;
77 Filename = __llvm_profile_CurrentFilename;
78 if (!Filename || !Filename[0])
82 if (strchr(Filename, '/')) {
83 char *Copy = malloc(strlen(Filename) + 1);
84 strcpy(Copy, Filename);
90 File = fopen(Filename, "w");
96 static void setFilename(const char *Filename, int OwnsFilename) {
97 /* Check if this is a new filename and therefore needs truncation. */
99 (Filename && strcmp(Filename, __llvm_profile_CurrentFilename));
103 __llvm_profile_CurrentFilename = Filename;
114 static int setFilenamePossiblyWithPid(const char *Filename) {
121 /* Reset filename on NULL, except with env var which is checked by caller. */
122 if (!Filename) {
127 /* Check the filename for "%p", which indicates a pid-substitution. */
128 for (I = 0; Filename[I]; ++I)
129 if (Filename[I] == '%' && Filename[++I] == 'p')
136 setFilename(Filename, 0);
140 /* Allocate enough space for the substituted filename. */
145 /* Construct the new filename. */
146 for (I = 0, J = 0; Filename[I]; ++I)
147 if (Filename[I] == '%') {
148 if (Filename[++I] == 'p') {
154 Allocated[J++] = Filename[I];
163 const char *Filename = getenv("LLVM_PROFILE_FILE");
165 if (!Filename || !Filename[0])
168 return setFilenamePossiblyWithPid(Filename);
180 /* Check if the filename has been initialized. */
184 /* Detect the filename and truncate. */
189 void __llvm_profile_set_filename(const char *Filename) {
190 setFilenamePossiblyWithPid(Filename);
194 void __llvm_profile_override_default_filename(const char *Filename) {
195 /* If the env var is set, skip setting filename from argument. */
199 setFilenamePossiblyWithPid(Filename);
207 /* Check the filename. */
209 PROF_ERR("LLVM Profile: Failed to write file : %s\n", "Filename not set");