diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-09-27 12:52:55 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-09-27 12:52:55 +0000 |
commit | dc6c6d31d797300be4cbe899b4493c48900ffa65 (patch) | |
tree | e53d40e439d48e3310c6572fdcd0e648f79c1b1f | |
parent | f3477c13eeaf11b32a41f181398fb5deffd0dd73 (diff) |
Shrink LinkageInfo from 96 bits to 8 bits.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164771 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Decl.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 48a0816593..ee9fefa5ba 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -214,16 +214,19 @@ public: bool isCXXInstanceMember() const; class LinkageInfo { - Linkage linkage_; - Visibility visibility_; - bool explicit_; + uint8_t linkage_ : 4; + uint8_t visibility_ : 3; + uint8_t explicit_ : 1; void setVisibility(Visibility V, bool E) { visibility_ = V; explicit_ = E; } public: LinkageInfo() : linkage_(ExternalLinkage), visibility_(DefaultVisibility), explicit_(false) {} LinkageInfo(Linkage L, Visibility V, bool E) - : linkage_(L), visibility_(V), explicit_(E) {} + : linkage_(L), visibility_(V), explicit_(E) { + assert(linkage() == L && visibility() == V && visibilityExplicit() == E && + "Enum truncated!"); + } static LinkageInfo external() { return LinkageInfo(); @@ -238,8 +241,8 @@ public: return LinkageInfo(NoLinkage, DefaultVisibility, false); } - Linkage linkage() const { return linkage_; } - Visibility visibility() const { return visibility_; } + Linkage linkage() const { return (Linkage)linkage_; } + Visibility visibility() const { return (Visibility)visibility_; } bool visibilityExplicit() const { return explicit_; } void setLinkage(Linkage L) { linkage_ = L; } |