typedef llvm::DenseMap<const FileEntry*,std::pair<Offset,Offset> > PCHMap;
typedef llvm::DenseMap<const IdentifierInfo*,uint32_t> IDMap;
+static void Emit8(llvm::raw_ostream& Out, uint32_t V) {
+ Out << (unsigned char)(V);
+}
+
static void Emit32(llvm::raw_ostream& Out, uint32_t V) {
Out << (unsigned char)(V);
Out << (unsigned char)(V >> 8);
Out << (unsigned char)(V >> 24);
}
-static void Emit8(llvm::raw_ostream& Out, uint32_t V) {
+static void Emit16(llvm::raw_ostream& Out, uint32_t V) {
Out << (unsigned char)(V);
+ Out << (unsigned char)(V >> 8);
+ assert((V >> 16) == 0);
}
static void EmitBuf(llvm::raw_ostream& Out, const char* I, const char* E) {
Emit8(Out, T.getFlags());
Emit32(Out, ResolveID(IM, idcount, T.getIdentifierInfo()));
Emit32(Out, SMgr.getFullFilePos(T.getLocation()));
- Emit32(Out, T.getLength());
+ Emit16(Out, T.getLength());
}
struct IDData {
using namespace clang;
-#define DISK_TOKEN_SIZE (2+3*4)
+#define DISK_TOKEN_SIZE (2+4+4+2)
//===----------------------------------------------------------------------===//
// Utility methods for reading from the mmap'ed PTH file.
| (((uint32_t) CurPtrShadow[9]) << 24);
uint32_t Len = ((uint32_t) CurPtrShadow[10])
- | (((uint32_t) CurPtrShadow[11]) << 8)
- | (((uint32_t) CurPtrShadow[12]) << 16)
- | (((uint32_t) CurPtrShadow[13]) << 24);
+ | (((uint32_t) CurPtrShadow[11]) << 8);
CurPtr = (const char*) (CurPtrShadow + DISK_TOKEN_SIZE);