[llvm-branch-commits] [cfe-branch] r115276 - in /cfe/branches/Apple/whitney: include/clang/Lex/PreprocessingRecord.h lib/Serialization/ASTReader.cpp lib/Serialization/ASTWriter.cpp

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


Author: ddunbar
Date: Thu Sep 30 22:42:01 2010
New Revision: 115276

URL: http://llvm.org/viewvc/llvm-project?rev=115276&view=rev
Log:
Merge r114913:
--
Author: Sebastian Redl <sebastian.redl at getdesigned.at>
Date:   Mon Sep 27 22:18:47 2010 +0000

    When chaining PCHs, only write PPRecords that don't come from PCH, and give them the correct IDs. Fixes a crash in XCode.

Modified:
    cfe/branches/Apple/whitney/include/clang/Lex/PreprocessingRecord.h
    cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp
    cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp

Modified: cfe/branches/Apple/whitney/include/clang/Lex/PreprocessingRecord.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Lex/PreprocessingRecord.h?rev=115276&r1=115275&r2=115276&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Lex/PreprocessingRecord.h (original)
+++ cfe/branches/Apple/whitney/include/clang/Lex/PreprocessingRecord.h Thu Sep 30 22:42:01 2010
@@ -236,6 +236,10 @@
     /// \brief Set the external source for preprocessed entities.
     void SetExternalSource(ExternalPreprocessingRecordSource &Source,
                            unsigned NumPreallocatedEntities);
+
+    unsigned getNumPreallocatedEntities() const {
+      return NumPreallocatedEntities;
+    }
     
     /// \brief Set the preallocated entry at the given index to the given
     /// preprocessed entity.

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=115276&r1=115275&r2=115276&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp Thu Sep 30 22:42:01 2010
@@ -1474,7 +1474,7 @@
       MacroDefinitionsLoaded[Record[1]] = MD;
       return;
     }
-  }
+    }
   }
 }
 

Modified: cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp?rev=115276&r1=115275&r2=115276&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp Thu Sep 30 22:42:01 2010
@@ -1334,12 +1334,14 @@
   // If the preprocessor has a preprocessing record, emit it.
   unsigned NumPreprocessingRecords = 0;
   if (PPRec) {
-    for (PreprocessingRecord::iterator E = PPRec->begin(), EEnd = PPRec->end();
+    unsigned IndexBase = PPRec->getNumPreallocatedEntities();
+    for (PreprocessingRecord::iterator E = PPRec->begin(Chain),
+                                       EEnd = PPRec->end(Chain);
          E != EEnd; ++E) {
       Record.clear();
       
       if (MacroInstantiation *MI = dyn_cast<MacroInstantiation>(*E)) {
-        Record.push_back(NumPreprocessingRecords++);
+        Record.push_back(IndexBase + NumPreprocessingRecords++);
         AddSourceLocation(MI->getSourceRange().getBegin(), Record);
         AddSourceLocation(MI->getSourceRange().getEnd(), Record);
         AddIdentifierRef(MI->getName(), Record);
@@ -1359,7 +1361,7 @@
         } else
           MacroDefinitionOffsets.push_back(Stream.GetCurrentBitNo());
         
-        Record.push_back(NumPreprocessingRecords++);
+        Record.push_back(IndexBase + NumPreprocessingRecords++);
         Record.push_back(ID);
         AddSourceLocation(MD->getSourceRange().getBegin(), Record);
         AddSourceLocation(MD->getSourceRange().getEnd(), Record);





More information about the llvm-branch-commits mailing list