class BlockDecl;
class DeclarationName;
class CompoundStmt;
+}
+
+namespace llvm {
+// DeclContext* is only 4-byte aligned on 32-bit systems.
+template<>
+ class PointerLikeTypeTraits<clang::DeclContext*> {
+ typedef clang::DeclContext* PT;
+public:
+ static inline void *getAsVoidPointer(PT P) { return P; }
+ static inline PT getFromVoidPointer(void *P) {
+ return static_cast<PT>(P);
+ }
+ enum { NumLowBitsAvailable = 2 };
+};
+}
+
+namespace clang {
/// Decl - This represents one declaration (or definition), e.g. a variable,
/// typedef, function, struct, etc.
/// }
/// void A::f(); // SemanticDC == namespace 'A'
/// // LexicalDC == global namespace
- llvm::PointerIntPair<void*, 1, bool> DeclCtx;
+ llvm::PointerIntPair<DeclContext*, 1, bool> DeclCtx;
struct MultipleDC {
DeclContext *SemanticDC;
inline bool isOutOfSemaDC() const { return DeclCtx.getInt() != 0; }
inline MultipleDC *getMultipleDC() const {
assert(isOutOfSemaDC() && "Invalid accessor");
- return static_cast<MultipleDC*>(DeclCtx.getPointer());
+ return reinterpret_cast<MultipleDC*>(DeclCtx.getPointer());
}
inline DeclContext *getSemanticDC() const {
return clang::QualType::getFromOpaquePtr(P);
}
// CVR qualifiers go in low bits.
- static inline unsigned getNumLowBitsAvailable() { return 0; }
+ enum { NumLowBitsAvailable = 0 };
};
} // end namespace llvm
static inline clang::OpaquePtr<UID> getFromVoidPointer(void *P) {
return clang::OpaquePtr<UID>::make(P);
}
- static inline unsigned getNumLowBitsAvailable() { return 3; }
+ enum { NumLowBitsAvailable = 3 };
};
}
MultipleDC *MDC = new MultipleDC();
MDC->SemanticDC = getDeclContext();
MDC->LexicalDC = DC;
- DeclCtx.setPointer(MDC);
+ DeclCtx.setPointer(reinterpret_cast<DeclContext*>(MDC));
DeclCtx.setInt(true);
} else {
getMultipleDC()->LexicalDC = DC;
}
else {
MultipleDC *MDC = new MultipleDC();
- Dcl->DeclCtx.setPointer(MDC);
+ Dcl->DeclCtx.setPointer(reinterpret_cast<DeclContext*>(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.