It seems much safer to store a copy of the filename, as environment may be
modified our moved between llvm_profile_initialize_file() and
llvm_profile_write_file() function calls.
For example, Chromium does move the environment[1], so the pointer returned by
getenv() on a program startup is not valid at the moment when the program is
closed. Due to that, LLVM profiler cannot write data to the file.
Is that branch really used anywhere? It seems like it doesn't. And INSTR_PROF_PROFILE_NAME_VAR is just an array of 2 chars...
I'd actually prefer to do the following:
But I might be missing something, so decided to start with this the least intrusive patch :)
Please let me know what you think about that.