]> granicus.if.org Git - clang/commitdiff
Teach DeclContext deserialization to pay attention to endianness, from
authorDouglas Gregor <dgregor@apple.com>
Fri, 6 Jan 2012 16:09:53 +0000 (16:09 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 6 Jan 2012 16:09:53 +0000 (16:09 +0000)
David Fang and Takumi Nakamura. Fixes many PCH failures on PowerPC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147657 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReader.cpp
lib/Serialization/ASTReaderInternals.h

index a7d143b030f5bb505752fe2725eea2ab96edd069..2864fcf48ba9b1f4bedb86723b90f898a38c29b7 100644 (file)
@@ -747,7 +747,7 @@ ASTDeclContextNameLookupTrait::ReadData(internal_key_type,
                                       unsigned DataLen) {
   using namespace clang::io;
   unsigned NumDecls = ReadUnalignedLE16(d);
-  DeclID *Start = (DeclID *)d;
+  LE32DeclID *Start = (LE32DeclID *)d;
   return std::make_pair(Start, Start + NumDecls);
 }
 
index fb6c8307ca2bd3b905361c0c4734c9f195d901c2..635f95fe594e04585964b651e41ab7fd551e071f 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/OnDiskHashTable.h"
 #include "clang/AST/DeclarationName.h"
+#include "llvm/Support/Endian.h"
 #include <utility>
 #include <sys/stat.h>
 
@@ -41,7 +42,8 @@ public:
   ///
   /// Note that these declaration IDs are local to the module that contains this
   /// particular lookup t
-  typedef std::pair<DeclID *, DeclID *> data_type;
+  typedef llvm::support::ulittle32_t LE32DeclID;
+  typedef std::pair<LE32DeclID *, LE32DeclID *> data_type;
 
   /// \brief Special internal key for declaration names.
   /// The hash table creates keys for comparison; we do not create