From 26c7dc32c7cc204b8255e4f5cbe48fbdb50ef5fa Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 30 Aug 2013 04:45:38 +0000 Subject: [PATCH] Simplify slightly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189645 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/DeclAccessPair.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/clang/AST/DeclAccessPair.h b/include/clang/AST/DeclAccessPair.h index 5731308f55..3c5056c6e5 100644 --- a/include/clang/AST/DeclAccessPair.h +++ b/include/clang/AST/DeclAccessPair.h @@ -28,7 +28,7 @@ class NamedDecl; /// A POD class for pairing a NamedDecl* with an access specifier. /// Can be put into unions. class DeclAccessPair { - NamedDecl *Ptr; // we'd use llvm::PointerUnion, but it isn't trivial + uintptr_t Ptr; // we'd use llvm::PointerUnion, but it isn't trivial enum { Mask = 0x3 }; @@ -40,10 +40,10 @@ public: } NamedDecl *getDecl() const { - return (NamedDecl*) (~Mask & (uintptr_t) Ptr); + return reinterpret_cast(~Mask & Ptr); } AccessSpecifier getAccess() const { - return AccessSpecifier(Mask & (uintptr_t) Ptr); + return AccessSpecifier(Mask & Ptr); } void setDecl(NamedDecl *D) { @@ -53,8 +53,7 @@ public: set(getDecl(), AS); } void set(NamedDecl *D, AccessSpecifier AS) { - Ptr = reinterpret_cast(uintptr_t(AS) | - reinterpret_cast(D)); + Ptr = uintptr_t(AS) | reinterpret_cast(D); } operator NamedDecl*() const { return getDecl(); } -- 2.50.1