diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-27 18:46:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-27 18:46:15 +0000 |
commit | 10d8379676f32b493740a5509e2cd7f0d6433139 (patch) | |
tree | 91b936e0019ee326402c9210ef412808ca5b4bfc /lib/AST | |
parent | ee760330a415635369556796a97afcfd6207f4dc (diff) |
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
Diffstat (limited to 'lib/AST')
-rw-r--r-- | lib/AST/DeclBase.cpp | 6 | ||||
-rw-r--r-- | lib/AST/DeclSerialization.cpp | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index cb12618443..47059d952c 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -121,7 +121,8 @@ void Decl::setDeclContext(DeclContext *DC) { 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 @@ void Decl::setLexicalDeclContext(DeclContext *DC) { 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 e4534a2686..4b32d81936 100644 --- a/lib/AST/DeclSerialization.cpp +++ b/lib/AST/DeclSerialization.cpp @@ -125,7 +125,7 @@ Decl* Decl::Create(Deserializer& D, ASTContext& C) { 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 @@ Decl* Decl::Create(Deserializer& D, ASTContext& C) { 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); |