summaryrefslogtreecommitdiffstats
path: root/clang/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
commitacfc76cc636f2dc46c921a4c7fa41d51d8bf447d (patch)
treee20b9eefa3c217685c6ea9b4e44c31808a0b08e1 /clang/lib/Frontend/PCHWriter.cpp
parentf00919a040917799b619e5f00c4d586c9f3db108 (diff)
downloadbcm5719-llvm-acfc76cc636f2dc46c921a4c7fa41d51d8bf447d.tar.gz
bcm5719-llvm-acfc76cc636f2dc46c921a4c7fa41d51d8bf447d.zip
Support locally-declared external declarations in PCH files
llvm-svn: 69833
Diffstat (limited to 'clang/lib/Frontend/PCHWriter.cpp')
-rw-r--r--clang/lib/Frontend/PCHWriter.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp
index 097ced2363c..0aada625994 100644
--- a/clang/lib/Frontend/PCHWriter.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud