diff options
| author | Xinliang David Li <davidxl@google.com> | 2015-10-16 22:21:56 +0000 |
|---|---|---|
| committer | Xinliang David Li <davidxl@google.com> | 2015-10-16 22:21:56 +0000 |
| commit | 4da5de9c347b19772ac05b25b1f1e8298af96139 (patch) | |
| tree | 61667a42ea05b5d66e99ecc7a679519a4a4d110c /compiler-rt/lib/profile/InstrProfilingFile.c | |
| parent | bbd524496ccf5946c771a61d2d490675156518d0 (diff) | |
| download | bcm5719-llvm-4da5de9c347b19772ac05b25b1f1e8298af96139.tar.gz bcm5719-llvm-4da5de9c347b19772ac05b25b1f1e8298af96139.zip | |
Use struct type instead of raw array for raw profile header (NFC)
This patch introduces a well defined header struct
to represent raw profile header instead of using raw array.
Previously the raw array is used in two different files and
is very error prone when header structure is re-organized.
This is a small cleanup with NFC.
llvm-svn: 250561
Diffstat (limited to 'compiler-rt/lib/profile/InstrProfilingFile.c')
| -rw-r--r-- | compiler-rt/lib/profile/InstrProfilingFile.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c index 68e8c7b0787..6af835e484a 100644 --- a/compiler-rt/lib/profile/InstrProfilingFile.c +++ b/compiler-rt/lib/profile/InstrProfilingFile.c @@ -35,19 +35,19 @@ static int writeFile(FILE *File) { const char Zeroes[sizeof(uint64_t)] = {0}; /* Create the header. */ - uint64_t Header[PROFILE_HEADER_SIZE]; - Header[0] = __llvm_profile_get_magic(); - Header[1] = __llvm_profile_get_version(); - Header[2] = DataSize; - Header[3] = CountersSize; - Header[4] = NamesSize; - Header[5] = (uintptr_t)CountersBegin; - Header[6] = (uintptr_t)NamesBegin; + __llvm_profile_header Header; + Header.Magic = __llvm_profile_get_magic(); + Header.Version = __llvm_profile_get_version(); + Header.DataSize = DataSize; + Header.CountersSize = CountersSize; + Header.NamesSize = NamesSize; + Header.CountersDelta = (uintptr_t)CountersBegin; + Header.NamesDelta = (uintptr_t)NamesBegin; /* Write the data. */ #define CHECK_fwrite(Data, Size, Length, File) \ do { if (fwrite(Data, Size, Length, File) != Length) return -1; } while (0) - CHECK_fwrite(Header, sizeof(uint64_t), PROFILE_HEADER_SIZE, File); + CHECK_fwrite(&Header, sizeof(__llvm_profile_header), 1, File); CHECK_fwrite(DataBegin, sizeof(__llvm_profile_data), DataSize, File); CHECK_fwrite(CountersBegin, sizeof(uint64_t), CountersSize, File); CHECK_fwrite(NamesBegin, sizeof(char), NamesSize, File); |

