[llvm-branch-commits] [cfe-branch] r115279 - /cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp

Daniel Dunbar daniel at zuster.org
Thu Sep 30 20:42:08 PDT 2010


Author: ddunbar
Date: Thu Sep 30 22:42:08 2010
New Revision: 115279

URL: http://llvm.org/viewvc/llvm-project?rev=115279&view=rev
Log:
Merge r114940:
--
Author: Sebastian Redl <sebastian.redl at getdesigned.at>
Date:   Tue Sep 28 02:55:49 2010 +0000

    Fix a bug in loading macro records. Fixes yet another crash in libclang.

Modified:
    cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp

Modified: cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp?rev=115279&r1=115278&r2=115279&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp Thu Sep 30 22:42:08 2010
@@ -1494,6 +1494,7 @@
 
     RecordData Record;
     while (true) {
+      uint64_t Offset = Cursor.GetCurrentBitNo();
       unsigned Code = Cursor.ReadCode();
       if (Code == llvm::bitc::END_BLOCK) {
         if (Cursor.ReadBlockEnd()) {
@@ -1538,7 +1539,8 @@
       case PP_MACRO_INSTANTIATION:
       case PP_MACRO_DEFINITION:
         // Read the macro record.
-        ReadMacroRecord(Chain[N - I - 1]->Stream, Cursor.GetCurrentBitNo());
+        // FIXME: That's a stupid way to do this. We should reuse this cursor.
+        ReadMacroRecord(Chain[N - I - 1]->Stream, Offset);
         break;
       }
     }
@@ -3190,9 +3192,8 @@
       continue;
 
     // Load all of the declaration IDs
-    for (const DeclID *ID = I->LexicalDecls,
-                           *IDE = ID + I->NumLexicalDecls;
-        ID != IDE; ++ID) {
+    for (const DeclID *ID = I->LexicalDecls, *IDE = ID + I->NumLexicalDecls;
+         ID != IDE; ++ID) {
       Decl *D = GetDecl(*ID);
       assert(D && "Null decl in lexical decls");
       Decls.push_back(D);





More information about the llvm-branch-commits mailing list