[llvm] r203709 - Profile: Avoid an unnecessary __attribute__((packed))

Justin Bogner mail at justinbogner.com
Wed Mar 12 13:40:15 PDT 2014


Author: bogner
Date: Wed Mar 12 15:40:14 2014
New Revision: 203709

URL: http://llvm.org/viewvc/llvm-project?rev=203709&view=rev
Log:
Profile: Avoid an unnecessary __attribute__((packed))

MSVC doesn't understand it, and it wasn't really necessary anyway.

Modified:
    llvm/trunk/include/llvm/Profile/ProfileData.h
    llvm/trunk/include/llvm/Profile/ProfileDataWriter.h

Modified: llvm/trunk/include/llvm/Profile/ProfileData.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Profile/ProfileData.h?rev=203709&r1=203708&r2=203709&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Profile/ProfileData.h (original)
+++ llvm/trunk/include/llvm/Profile/ProfileData.h Wed Mar 12 15:40:14 2014
@@ -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();
 

Modified: llvm/trunk/include/llvm/Profile/ProfileDataWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Profile/ProfileDataWriter.h?rev=203709&r1=203708&r2=203709&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Profile/ProfileDataWriter.h (original)
+++ llvm/trunk/include/llvm/Profile/ProfileDataWriter.h Wed Mar 12 15:40:14 2014
@@ -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"
 
@@ -23,14 +24,6 @@
 
 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);





More information about the llvm-commits mailing list