aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReaderDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-05 10:38:01 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-05 10:38:01 +0000
commitc8f9af2943699ff623ca08f2e5ed4d72e0351189 (patch)
tree19087b3d17769386fae0492c67db32823af27579 /lib/Frontend/PCHReaderDecl.cpp
parent7b081c8604efd33bc7f7e5c1e9427a031eedb2b4 (diff)
Read/write the identifier namespace in PCH for decls that may modify it.
We can now use a PCH'ed <map>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107617 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReaderDecl.cpp')
-rw-r--r--lib/Frontend/PCHReaderDecl.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp
index 1a1f23fc49..595a87b3ad 100644
--- a/lib/Frontend/PCHReaderDecl.cpp
+++ b/lib/Frontend/PCHReaderDecl.cpp
@@ -159,6 +159,7 @@ void PCHDeclReader::VisitTypedefDecl(TypedefDecl *TD) {
void PCHDeclReader::VisitTagDecl(TagDecl *TD) {
VisitTypeDecl(TD);
+ TD->IdentifierNamespace = Record[Idx++];
TD->setPreviousDeclaration(
cast_or_null<TagDecl>(Reader.GetDecl(Record[Idx++])));
TD->setTagKind((TagDecl::TagKind)Record[Idx++]);
@@ -210,6 +211,7 @@ void PCHDeclReader::VisitDeclaratorDecl(DeclaratorDecl *DD) {
void PCHDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
VisitDeclaratorDecl(FD);
+ FD->IdentifierNamespace = Record[Idx++];
switch ((FunctionDecl::TemplatedKind)Record[Idx++]) {
default: assert(false && "Unhandled TemplatedKind!");
break;
@@ -282,7 +284,9 @@ void PCHDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
// FunctionDecl's body is handled last at PCHReaderDecl::Visit,
// after everything else is read.
- FD->setPreviousDeclaration(
+ // Avoid side effects and invariant checking of FunctionDecl's
+ // setPreviousDeclaration.
+ FD->redeclarable_base::setPreviousDeclaration(
cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++])));
FD->setStorageClass((FunctionDecl::StorageClass)Record[Idx++]);
FD->setStorageClassAsWritten((FunctionDecl::StorageClass)Record[Idx++]);
@@ -304,11 +308,6 @@ void PCHDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
for (unsigned I = 0; I != NumParams; ++I)
Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
FD->setParams(Params.data(), NumParams);
-
- // FIXME: order this properly w.r.t. friendness
- // FIXME: this same thing needs to happen for function templates
- if (FD->isOverloadedOperator() && !FD->getDeclContext()->isRecord())
- FD->setNonMemberOperator();
}
void PCHDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
@@ -822,6 +821,7 @@ void PCHDeclReader::VisitAccessSpecDecl(AccessSpecDecl *D) {
}
void PCHDeclReader::VisitFriendDecl(FriendDecl *D) {
+ VisitDecl(D);
if (Record[Idx++])
D->Friend = Reader.GetTypeSourceInfo(Record, Idx);
else
@@ -846,6 +846,7 @@ void PCHDeclReader::VisitTemplateDecl(TemplateDecl *D) {
void PCHDeclReader::VisitClassTemplateDecl(ClassTemplateDecl *D) {
VisitTemplateDecl(D);
+ D->IdentifierNamespace = Record[Idx++];
ClassTemplateDecl *PrevDecl =
cast_or_null<ClassTemplateDecl>(Reader.GetDecl(Record[Idx++]));
D->setPreviousDeclaration(PrevDecl);
@@ -952,6 +953,7 @@ void PCHDeclReader::VisitClassTemplatePartialSpecializationDecl(
void PCHDeclReader::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
VisitTemplateDecl(D);
+ D->IdentifierNamespace = Record[Idx++];
FunctionTemplateDecl *PrevDecl =
cast_or_null<FunctionTemplateDecl>(Reader.GetDecl(Record[Idx++]));
D->setPreviousDeclaration(PrevDecl);