summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-22 22:02:47 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-22 22:02:47 +0000
commitd4df8657b4fda675907987aa1742b6244f625de2 (patch)
tree93687d86225e3a9074f39298b6f47cd066e4fde7 /clang/lib/Frontend/PCHWriter.cpp
parent48db39dc90c9cc6fbef608b6601d31b36e6c2f40 (diff)
downloadbcm5719-llvm-d4df8657b4fda675907987aa1742b6244f625de2.tar.gz
bcm5719-llvm-d4df8657b4fda675907987aa1742b6244f625de2.zip
Support tentative definitions in precompiled headers. This isn't likely
to happen (ever), but at least we'll do the right thing when it does. llvm-svn: 69829
Diffstat (limited to 'clang/lib/Frontend/PCHWriter.cpp')
-rw-r--r--clang/lib/Frontend/PCHWriter.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp
index b081a2813f9..097ced2363c 100644
--- a/clang/lib/Frontend/PCHWriter.cpp
+++ b/clang/lib/Frontend/PCHWriter.cpp
@@ -2024,6 +2024,15 @@ void PCHWriter::WritePCH(Sema &SemaRef) {
getIdentifierRef(&Table.get(BuiltinNames[I]));
}
+ // Build a record containing all of the tentative definitions in
+ // this header file. Generally, this record will be empty.
+ RecordData TentativeDefinitions;
+ for (llvm::DenseMap<DeclarationName, VarDecl *>::iterator
+ TD = SemaRef.TentativeDefinitions.begin(),
+ TDEnd = SemaRef.TentativeDefinitions.end();
+ TD != TDEnd; ++TD)
+ AddDeclRef(TD->second, TentativeDefinitions);
+
// Write the remaining PCH contents.
RecordData Record;
Stream.EnterSubblock(pch::PCH_BLOCK_ID, 3);
@@ -2042,8 +2051,13 @@ void PCHWriter::WritePCH(Sema &SemaRef) {
AddTypeRef(Context.getBuiltinVaListType(), Record);
Stream.EmitRecord(pch::SPECIAL_TYPES, Record);
+ // Write the record containing external, unnamed definitions.
if (!ExternalDefinitions.empty())
Stream.EmitRecord(pch::EXTERNAL_DEFINITIONS, ExternalDefinitions);
+
+ // Write the record containing tentative definitions.
+ if (!TentativeDefinitions.empty())
+ Stream.EmitRecord(pch::TENTATIVE_DEFINITIONS, TentativeDefinitions);
// Some simple statistics
Record.clear();
OpenPOWER on IntegriCloud