[cfe-commits] r147657 - in /cfe/trunk/lib/Serialization: ASTReader.cpp ASTReaderInternals.h

Douglas Gregor dgregor at apple.com
Fri Jan 6 08:09:53 PST 2012


Author: dgregor
Date: Fri Jan  6 10:09:53 2012
New Revision: 147657

URL: http://llvm.org/viewvc/llvm-project?rev=147657&view=rev
Log:
Teach DeclContext deserialization to pay attention to endianness, from
David Fang and Takumi Nakamura. Fixes many PCH failures on PowerPC.

Modified:
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/lib/Serialization/ASTReaderInternals.h

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=147657&r1=147656&r2=147657&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Jan  6 10:09:53 2012
@@ -747,7 +747,7 @@
                                       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);
 }
 

Modified: cfe/trunk/lib/Serialization/ASTReaderInternals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderInternals.h?rev=147657&r1=147656&r2=147657&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderInternals.h (original)
+++ cfe/trunk/lib/Serialization/ASTReaderInternals.h Fri Jan  6 10:09:53 2012
@@ -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 @@
   ///
   /// 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





More information about the cfe-commits mailing list