[PATCH] D23826: Remove excessive padding from PTHStatData

Alexander Shaposhnikov via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 23 19:33:54 PDT 2016


alexshap created this revision.
alexshap added reviewers: mehdi_amini, bkramer.
alexshap added a subscriber: cfe-commits.
alexshap set the repository for this revision to rL LLVM.
alexshap changed the visibility of this Differential Revision from "Public (No Login Required)" to "All Users".

The class PTHStatData is in llvm/tools/clang/lib/Lex/PTHLexer.cpp inside anonymous namespace.
This diff reorders the fields and removes excessive padding.
llvm/tools/clang/lib/Lex/PTHLexer.cpp:629:7: warning: Excessive padding in 'class (anonymous namespace)::PTHStatData' (14 padding bytes, where 6 is optimal). Optimal fields order: Size, ModTime, UniqueID, HasData, IsDirectory, consider reordering the fields or adding explicit padding members.
Test plan: make -j8 check-clang (passed)



Repository:
  rL LLVM

https://reviews.llvm.org/D23826

Files:
  lib/Lex/PTHLexer.cpp

Index: lib/Lex/PTHLexer.cpp
===================================================================
--- lib/Lex/PTHLexer.cpp
+++ lib/Lex/PTHLexer.cpp
@@ -628,15 +628,15 @@
 namespace {
 class PTHStatData {
 public:
-  const bool HasData;
   uint64_t Size;
   time_t ModTime;
   llvm::sys::fs::UniqueID UniqueID;
+  const bool HasData;
   bool IsDirectory;
 
   PTHStatData(uint64_t Size, time_t ModTime, llvm::sys::fs::UniqueID UniqueID,
               bool IsDirectory)
-      : HasData(true), Size(Size), ModTime(ModTime), UniqueID(UniqueID),
+      : Size(Size), ModTime(ModTime), UniqueID(UniqueID), HasData(true),
         IsDirectory(IsDirectory) {}
 
   PTHStatData() : HasData(false) {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23826.69071.patch
Type: text/x-patch
Size: 691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160824/9bc0c0ce/attachment.bin>


More information about the cfe-commits mailing list