Profile: Avoid an unnecessary __attribute__((packed))
authorJustin Bogner <mail@justinbogner.com>
Wed, 12 Mar 2014 20:40:14 +0000 (20:40 +0000)
committerJustin Bogner <mail@justinbogner.com>
Wed, 12 Mar 2014 20:40:14 +0000 (20:40 +0000)
MSVC doesn't understand it, and it wasn't really necessary anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203709 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Profile/ProfileData.h
include/llvm/Profile/ProfileDataWriter.h

index b25e82c1edc771fda2a57119970ec4a7b72c6eed..72cc840e803e11587303275b8238c39985046dc5 100644 (file)
@@ -23,6 +23,7 @@ namespace llvm {
 
 const char PROFILEDATA_MAGIC[4] = {'L', 'P', 'R', 'F'};
 const uint32_t PROFILEDATA_VERSION = 1;
+const uint32_t PROFILEDATA_HEADER_SIZE = 24;
 
 const error_category &profiledata_category();
 
index 7e7802a83c7b9c09dae420a325ef49e1967872ad..3498d2eca3ed8b1e13166c5c33a161e33afc7019 100644 (file)
@@ -16,6 +16,7 @@
 #define LLVM_PROFILE_PROFILEDATA_WRITER_H__
 
 #include "llvm/ADT/StringMap.h"
+#include "llvm/Profile/ProfileData.h"
 #include "llvm/Support/DataTypes.h"
 #include "llvm/Support/raw_ostream.h"
 
 
 namespace llvm {
 
-struct __attribute__((packed)) ProfileDataHeader {
-  char     Magic[4];
-  uint32_t Version;
-  uint32_t DataStart;
-  uint32_t Padding;
-  uint64_t MaxFunctionCount;
-};
-
 /// Writer for instrumentation based profile data
 class ProfileDataWriter {
   StringMap<size_t> FunctionOffsets;
@@ -42,7 +35,7 @@ class ProfileDataWriter {
   void write64(raw_ostream &OS, uint64_t Value);
 public:
   ProfileDataWriter()
-      : DataStart(sizeof(ProfileDataHeader)), MaxFunctionCount(0) {}
+      : DataStart(PROFILEDATA_HEADER_SIZE), MaxFunctionCount(0) {}
 
   void addFunctionCounts(StringRef FuncName, uint64_t FunctionHash,
                          uint64_t NumCounters, const uint64_t *Counters);