aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReaderDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-21 18:22:14 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-21 18:22:14 +0000
commit0cef483f3b9d6a7f9fdbc5910d0a3ed64130e8e1 (patch)
treead7fdcfcf5bff9ee72ff1f7d16b2f10d03077e8e /lib/Frontend/PCHReaderDecl.cpp
parent5e895a87d001ea2e97f5201d22cc5241992ca5a2 (diff)
Implement PCH support for C++ namespaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96738 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReaderDecl.cpp')
-rw-r--r--lib/Frontend/PCHReaderDecl.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp
index af69664fe1..27349ecbfe 100644
--- a/lib/Frontend/PCHReaderDecl.cpp
+++ b/lib/Frontend/PCHReaderDecl.cpp
@@ -39,6 +39,7 @@ namespace {
void VisitDecl(Decl *D);
void VisitTranslationUnitDecl(TranslationUnitDecl *TU);
void VisitNamedDecl(NamedDecl *ND);
+ void VisitNamespaceDecl(NamespaceDecl *D);
void VisitTypeDecl(TypeDecl *TD);
void VisitTypedefDecl(TypedefDecl *TD);
void VisitTagDecl(TagDecl *TD);
@@ -96,6 +97,18 @@ void PCHDeclReader::VisitNamedDecl(NamedDecl *ND) {
ND->setDeclName(Reader.ReadDeclarationName(Record, Idx));
}
+void PCHDeclReader::VisitNamespaceDecl(NamespaceDecl *D) {
+ VisitNamedDecl(D);
+ D->setLBracLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+ D->setRBracLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+ D->setNextNamespace(
+ cast_or_null<NamespaceDecl>(Reader.GetDecl(Record[Idx++])));
+ D->setOriginalNamespace(
+ cast_or_null<NamespaceDecl>(Reader.GetDecl(Record[Idx++])));
+ D->setAnonymousNamespace(
+ cast_or_null<NamespaceDecl>(Reader.GetDecl(Record[Idx++])));
+}
+
void PCHDeclReader::VisitTypeDecl(TypeDecl *TD) {
VisitNamedDecl(TD);
TD->setTypeForDecl(Reader.GetType(Record[Idx++]).getTypePtr());
@@ -743,6 +756,10 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) {
case pch::DECL_BLOCK:
D = BlockDecl::Create(*Context, 0, SourceLocation());
break;
+
+ case pch::DECL_NAMESPACE:
+ D = NamespaceDecl::Create(*Context, 0, SourceLocation(), 0);
+ break;
}
assert(D && "Unknown declaration reading PCH file");