change Decl::DeclCtx to use a PointerIntPair instead of hand bitmangling.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67858 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index cb12618..47059d9 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -121,7 +121,8 @@
   if (isOutOfSemaDC())
     delete getMultipleDC();
   
-  DeclCtx = reinterpret_cast<uintptr_t>(DC);
+  DeclCtx.setPointer(DC);
+  DeclCtx.setInt(false);
 }
 
 void Decl::setLexicalDeclContext(DeclContext *DC) {
@@ -132,7 +133,8 @@
     MultipleDC *MDC = new MultipleDC();
     MDC->SemanticDC = getDeclContext();
     MDC->LexicalDC = DC;
-    DeclCtx = reinterpret_cast<uintptr_t>(MDC) | 0x1;
+    DeclCtx.setPointer(MDC);
+    DeclCtx.setInt(true);
   } else {
     getMultipleDC()->LexicalDC = DC;
   }
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index e4534a2..4b32d81 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -125,7 +125,7 @@
   Dcl->Implicit = D.ReadBool();
   Dcl->Access = D.ReadInt();
 
-  assert(Dcl->DeclCtx == 0);
+  assert(Dcl->DeclCtx.getOpaqueValue() == 0);
 
   const SerializedPtrID &SemaDCPtrID = D.ReadPtrID();
   const SerializedPtrID &LexicalDCPtrID = D.ReadPtrID();
@@ -133,11 +133,14 @@
   if (SemaDCPtrID == LexicalDCPtrID) {
     // Allow back-patching.  Observe that we register the variable of the
     // *object* for back-patching. Its actual value will get filled in later.
-    D.ReadUIntPtr(Dcl->DeclCtx, SemaDCPtrID); 
+    uintptr_t X;
+    D.ReadUIntPtr(X, SemaDCPtrID); 
+    Dcl->DeclCtx.setFromOpaqueValue(reinterpret_cast<void*>(X));
   }
   else {
     MultipleDC *MDC = new MultipleDC();
-    Dcl->DeclCtx = reinterpret_cast<uintptr_t>(MDC) | 0x1;
+    Dcl->DeclCtx.setPointer(MDC);
+    Dcl->DeclCtx.setInt(true);
     // Allow back-patching.  Observe that we register the variable of the
     // *object* for back-patching. Its actual value will get filled in later.
     D.ReadPtr(MDC->SemanticDC, SemaDCPtrID);