aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-22 22:18:58 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-22 22:18:58 +0000
commit14c22f20c077cecd68581952a0c227f8c180be03 (patch)
tree80d4b7c998c914568cba2d56939fd25f4c990f63 /lib/Frontend/PCHWriter.cpp
parent0838ba65aca1651db5374d6fdb9e6a7556e815ad (diff)
Support locally-declared external declarations in PCH files
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69833 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHWriter.cpp')
-rw-r--r--lib/Frontend/PCHWriter.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index 097ced2363..0aada62599 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -2033,6 +2033,16 @@ void PCHWriter::WritePCH(Sema &SemaRef) {
TD != TDEnd; ++TD)
AddDeclRef(TD->second, TentativeDefinitions);
+ // Build a record containing all of the locally-scoped external
+ // declarations in this header file. Generally, this record will be
+ // empty.
+ RecordData LocallyScopedExternalDecls;
+ for (llvm::DenseMap<DeclarationName, NamedDecl *>::iterator
+ TD = SemaRef.LocallyScopedExternalDecls.begin(),
+ TDEnd = SemaRef.LocallyScopedExternalDecls.end();
+ TD != TDEnd; ++TD)
+ AddDeclRef(TD->second, LocallyScopedExternalDecls);
+
// Write the remaining PCH contents.
RecordData Record;
Stream.EnterSubblock(pch::PCH_BLOCK_ID, 3);
@@ -2058,6 +2068,11 @@ void PCHWriter::WritePCH(Sema &SemaRef) {
// Write the record containing tentative definitions.
if (!TentativeDefinitions.empty())
Stream.EmitRecord(pch::TENTATIVE_DEFINITIONS, TentativeDefinitions);
+
+ // Write the record containing locally-scoped external definitions.
+ if (!LocallyScopedExternalDecls.empty())
+ Stream.EmitRecord(pch::LOCALLY_SCOPED_EXTERNAL_DECLS,
+ LocallyScopedExternalDecls);
// Some simple statistics
Record.clear();