[PATCH] D19934: [NFC] Reorder fields of VersionTuple to reduce size
Erik Pilkington via cfe-commits
cfe-commits at lists.llvm.org
Wed May 4 13:20:05 PDT 2016
erik.pilkington created this revision.
erik.pilkington added a reviewer: rsmith.
erik.pilkington added a subscriber: cfe-commits.
Previously, `clang::VersionTuple`'s fields were laid out in an unfortunate way that made the object larger than it ought to have been. This patch just reorders the fields, reducing the size.
http://reviews.llvm.org/D19934
Files:
include/clang/Basic/VersionTuple.h
Index: include/clang/Basic/VersionTuple.h
===================================================================
--- include/clang/Basic/VersionTuple.h
+++ include/clang/Basic/VersionTuple.h
@@ -25,39 +25,44 @@
/// \brief Represents a version number in the form major[.minor[.subminor[.build]]].
class VersionTuple {
unsigned Major : 31;
+
+ unsigned UsesUnderscores : 1;
+
unsigned Minor : 31;
- unsigned Subminor : 31;
- unsigned Build : 31;
unsigned HasMinor : 1;
+
+ unsigned Subminor : 31;
unsigned HasSubminor : 1;
+
+ unsigned Build : 31;
unsigned HasBuild : 1;
- unsigned UsesUnderscores : 1;
public:
VersionTuple()
- : Major(0), Minor(0), Subminor(0), Build(0), HasMinor(false),
- HasSubminor(false), HasBuild(false), UsesUnderscores(false) {}
+ : Major(0), UsesUnderscores(false), Minor(0), HasMinor(false),
+ Subminor(0), HasSubminor(false), Build(0), HasBuild(false) {}
explicit VersionTuple(unsigned Major)
- : Major(Major), Minor(0), Subminor(0), Build(0), HasMinor(false),
- HasSubminor(false), HasBuild(false), UsesUnderscores(false) {}
+ : Major(Major), UsesUnderscores(false), Minor(0), HasMinor(false),
+ Subminor(0), HasSubminor(false), Build(0), HasBuild(false) {}
explicit VersionTuple(unsigned Major, unsigned Minor,
bool UsesUnderscores = false)
- : Major(Major), Minor(Minor), Subminor(0), Build(0), HasMinor(true),
- HasSubminor(false), HasBuild(false), UsesUnderscores(UsesUnderscores) {}
+ : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
+ HasMinor(true), Subminor(0), HasSubminor(false), Build(0),
+ HasBuild(false) {}
explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor,
bool UsesUnderscores = false)
- : Major(Major), Minor(Minor), Subminor(Subminor), Build(0),
- HasMinor(true), HasSubminor(true), HasBuild(false),
- UsesUnderscores(UsesUnderscores) {}
+ : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
+ HasMinor(true), Subminor(Subminor), HasSubminor(true), Build(0),
+ HasBuild(false) {}
explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor,
unsigned Build, bool UsesUnderscores = false)
- : Major(Major), Minor(Minor), Subminor(Subminor), Build(Build),
- HasMinor(true), HasSubminor(true), HasBuild(true),
- UsesUnderscores(UsesUnderscores) {}
+ : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
+ HasMinor(true), Subminor(Subminor), HasSubminor(true), Build(Build),
+ HasBuild(true) {}
/// \brief Determine whether this version information is empty
/// (e.g., all version components are zero).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19934.56171.patch
Type: text/x-patch
Size: 2800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160504/aed9ca67/attachment.bin>
More information about the cfe-commits
mailing list