[PATCH] D52268: [AST] Squeeze some bits in LinkageComputer

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 25 06:44:57 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342973: [AST] Squeeze some bits in LinkageComputer::QueryType (authored by brunoricci, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52268?vs=166264&id=166875#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52268

Files:
  cfe/trunk/lib/AST/Linkage.h


Index: cfe/trunk/lib/AST/Linkage.h
===================================================================
--- cfe/trunk/lib/AST/Linkage.h
+++ cfe/trunk/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 @@
   /// in computing linkage.
   unsigned IgnoreAllVisibility : 1;
 
+  enum { NumLVComputationKindBits = 3 };
+
   explicit LVComputationKind(NamedDecl::ExplicitVisibilityKind EK)
       : ExplicitKind(EK), IgnoreExplicitVisibility(false),
         IgnoreAllVisibility(false) {}
@@ -78,12 +81,14 @@
   // using C = Foo<B, B>;
   // using D = Foo<C, C>;
   //
-  // The unsigned represents an LVComputationKind.
-  using QueryType = std::pair<const NamedDecl *, unsigned>;
+  // The integer represents an LVComputationKind.
+  using QueryType =
+      llvm::PointerIntPair<const NamedDecl *,
+                           LVComputationKind::NumLVComputationKindBits>;
   llvm::SmallDenseMap<QueryType, LinkageInfo, 8> CachedLinkageInfo;
 
   static QueryType makeCacheKey(const NamedDecl *ND, LVComputationKind Kind) {
-    return std::make_pair(ND, Kind.toBits());
+    return QueryType(ND, Kind.toBits());
   }
 
   llvm::Optional<LinkageInfo> lookup(const NamedDecl *ND,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52268.166875.patch
Type: text/x-patch
Size: 1396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180925/709231f3/attachment.bin>


More information about the llvm-commits mailing list