From: Bruno Ricci Date: Tue, 25 Sep 2018 13:43:25 +0000 (+0000) Subject: [AST] Squeeze some bits in LinkageComputer::QueryType X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c607d94b4fac5562970d8609d27742b92c6207b;p=clang [AST] Squeeze some bits in LinkageComputer::QueryType Replace the pair std::pair where the unsigned represents an LVComputationKind by a PointerIntPair. This saves a pointer per entry in the map LinkageComputer::CachedLinkageInfo. Differential Revision: https://reviews.llvm.org/D52268 Reviewed by: rjmccall, george.burgess.iv, erichkeane git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342973 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Linkage.h b/lib/AST/Linkage.h index e6489c7ef2..8ad748bcc4 100644 --- a/lib/AST/Linkage.h +++ b/lib/AST/Linkage.h @@ -20,6 +20,7 @@ #include "clang/AST/Type.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Optional.h" +#include "llvm/ADT/PointerIntPair.h" namespace clang { /// Kinds of LV computation. The linkage side of the computation is @@ -36,6 +37,8 @@ struct LVComputationKind { /// in computing linkage. unsigned IgnoreAllVisibility : 1; + enum { NumLVComputationKindBits = 3 }; + explicit LVComputationKind(NamedDecl::ExplicitVisibilityKind EK) : ExplicitKind(EK), IgnoreExplicitVisibility(false), IgnoreAllVisibility(false) {} @@ -78,12 +81,14 @@ class LinkageComputer { // using C = Foo; // using D = Foo; // - // The unsigned represents an LVComputationKind. - using QueryType = std::pair; + // The integer represents an LVComputationKind. + using QueryType = + llvm::PointerIntPair; llvm::SmallDenseMap CachedLinkageInfo; static QueryType makeCacheKey(const NamedDecl *ND, LVComputationKind Kind) { - return std::make_pair(ND, Kind.toBits()); + return QueryType(ND, Kind.toBits()); } llvm::Optional lookup(const NamedDecl *ND,