riccibruno updated this revision to Diff 166264.
riccibruno marked 3 inline comments as done.
riccibruno added a comment.

Removed the superfluous static_assert.


Repository:
  rC Clang

https://reviews.llvm.org/D52268

Files:
  lib/AST/Linkage.h


Index: lib/AST/Linkage.h
===================================================================
--- lib/AST/Linkage.h
+++ 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,


Index: lib/AST/Linkage.h
===================================================================
--- lib/AST/Linkage.h
+++ 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,
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to