summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-04 18:21:45 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-04 18:21:45 +0000
commitdc72caa6dec6a66a0806096e3b2d398915a31900 (patch)
treebc1f8203848daf1da6f5657bd350403e405cb58f /clang/lib/Serialization/ASTWriter.cpp
parent0d4224ef04efff920270a48fef6ddca6f8349703 (diff)
downloadbcm5719-llvm-dc72caa6dec6a66a0806096e3b2d398915a31900.tar.gz
bcm5719-llvm-dc72caa6dec6a66a0806096e3b2d398915a31900.zip
When a type comes from a previously-loaded PCH/AST file, don't try to write it into a chained PCH file.
llvm-svn: 115527
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index c89680e2a6e..7e0cdf41d7e 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -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)
OpenPOWER on IntegriCloud