[cfe-commits] r67980 - in /cfe/trunk: include/clang/AST/DeclBase.h include/clang/AST/Type.h include/clang/Parse/Ownership.h lib/AST/DeclBase.cpp lib/AST/DeclSerialization.cpp
Chris Lattner
sabre at nondot.org
Sat Mar 28 21:32:54 PDT 2009
Author: lattner
Date: Sat Mar 28 23:32:54 2009
New Revision: 67980
URL: http://llvm.org/viewvc/llvm-project?rev=67980&view=rev
Log:
adjust to llvm mainline changes.
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/Parse/Ownership.h
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/AST/DeclSerialization.cpp
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=67980&r1=67979&r2=67980&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Sat Mar 28 23:32:54 2009
@@ -40,6 +40,23 @@
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 @@
/// }
/// 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 @@
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 {
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=67980&r1=67979&r2=67980&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Sat Mar 28 23:32:54 2009
@@ -234,7 +234,7 @@
return clang::QualType::getFromOpaquePtr(P);
}
// CVR qualifiers go in low bits.
- static inline unsigned getNumLowBitsAvailable() { return 0; }
+ enum { NumLowBitsAvailable = 0 };
};
} // end namespace llvm
Modified: cfe/trunk/include/clang/Parse/Ownership.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Ownership.h?rev=67980&r1=67979&r2=67980&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Ownership.h (original)
+++ cfe/trunk/include/clang/Parse/Ownership.h Sat Mar 28 23:32:54 2009
@@ -57,7 +57,7 @@
static inline clang::OpaquePtr<UID> getFromVoidPointer(void *P) {
return clang::OpaquePtr<UID>::make(P);
}
- static inline unsigned getNumLowBitsAvailable() { return 3; }
+ enum { NumLowBitsAvailable = 3 };
};
}
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=67980&r1=67979&r2=67980&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Sat Mar 28 23:32:54 2009
@@ -141,7 +141,7 @@
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;
Modified: cfe/trunk/lib/AST/DeclSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclSerialization.cpp?rev=67980&r1=67979&r2=67980&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclSerialization.cpp (original)
+++ cfe/trunk/lib/AST/DeclSerialization.cpp Sat Mar 28 23:32:54 2009
@@ -139,7 +139,7 @@
}
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.
More information about the cfe-commits
mailing list