r189645 - Simplify slightly.
Richard Smith
richard-llvm at metafoo.co.uk
Thu Aug 29 21:45:38 PDT 2013
Author: rsmith
Date: Thu Aug 29 23:45:38 2013
New Revision: 189645
URL: http://llvm.org/viewvc/llvm-project?rev=189645&view=rev
Log:
Simplify slightly.
Modified:
cfe/trunk/include/clang/AST/DeclAccessPair.h
Modified: cfe/trunk/include/clang/AST/DeclAccessPair.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclAccessPair.h?rev=189645&r1=189644&r2=189645&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclAccessPair.h (original)
+++ cfe/trunk/include/clang/AST/DeclAccessPair.h Thu Aug 29 23:45:38 2013
@@ -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<NamedDecl*>(~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<NamedDecl*>(uintptr_t(AS) |
- reinterpret_cast<uintptr_t>(D));
+ Ptr = uintptr_t(AS) | reinterpret_cast<uintptr_t>(D);
}
operator NamedDecl*() const { return getDecl(); }
More information about the cfe-commits
mailing list