]> granicus.if.org Git - clang/commitdiff
When a type comes from a previously-loaded PCH/AST file, don't try to write it into...
authorDouglas Gregor <dgregor@apple.com>
Mon, 4 Oct 2010 18:21:45 +0000 (18:21 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 4 Oct 2010 18:21:45 +0000 (18:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115527 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTWriter.cpp

index c89680e2a6ec0b1293fa8844d3b5a7165b41a823..7e0cdf41d7e9d6acef39d94d2b111e20367c188e 100644 (file)
@@ -1419,6 +1419,11 @@ void ASTWriter::WriteType(QualType T) {
   if (Idx.getIndex() == 0) // we haven't seen this type before.
     Idx = TypeIdx(NextTypeID++);
 
+  // If this type comes from a previously-loaded PCH/AST file, don't try to
+  // write the type again.
+  if (Idx.getIndex() < FirstTypeID)
+    return;
+
   // Record the offset for this type.
   unsigned Index = Idx.getIndex() - FirstTypeID;
   if (TypeOffsets.size() == Index)