forked from OSchip/llvm-project
parent
eb71b17705
commit
20d79aa1c2
|
@ -40,6 +40,23 @@ class LinkageSpecDecl;
|
|||
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.
|
||||
|
@ -109,7 +126,7 @@ private:
|
|||
/// }
|
||||
/// 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;
|
||||
|
@ -120,7 +137,7 @@ private:
|
|||
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 {
|
||||
|
|
|
@ -234,7 +234,7 @@ public:
|
|||
return clang::QualType::getFromOpaquePtr(P);
|
||||
}
|
||||
// CVR qualifiers go in low bits.
|
||||
static inline unsigned getNumLowBitsAvailable() { return 0; }
|
||||
enum { NumLowBitsAvailable = 0 };
|
||||
};
|
||||
} // end namespace llvm
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ 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 };
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ void Decl::setLexicalDeclContext(DeclContext *DC) {
|
|||
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;
|
||||
|
|
|
@ -139,7 +139,7 @@ Decl* Decl::Create(Deserializer& D, ASTContext& C) {
|
|||
}
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue