diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-02 11:55:40 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-02 11:55:40 +0000 |
commit | 5efb06f306c6526ad02ee2c166cbf67c04e38311 (patch) | |
tree | 55c8d7ba5ad073432f4f9b25459972c6f47a35a6 /lib/Frontend/PCHWriterDecl.cpp | |
parent | 7d530487714b300be95fd71de68a3287078a814f (diff) |
Fix reading FunctionDecls from PCH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107477 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHWriterDecl.cpp')
-rw-r--r-- | lib/Frontend/PCHWriterDecl.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/Frontend/PCHWriterDecl.cpp b/lib/Frontend/PCHWriterDecl.cpp index d43ba7a27f..cea7ba0d9e 100644 --- a/lib/Frontend/PCHWriterDecl.cpp +++ b/lib/Frontend/PCHWriterDecl.cpp @@ -199,24 +199,6 @@ void PCHDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) { void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) { VisitDeclaratorDecl(D); - Record.push_back(D->isThisDeclarationADefinition()); - if (D->isThisDeclarationADefinition()) - Writer.AddStmt(D->getBody()); - - Writer.AddDeclRef(D->getPreviousDeclaration(), Record); - Record.push_back(D->getStorageClass()); // FIXME: stable encoding - Record.push_back(D->getStorageClassAsWritten()); - Record.push_back(D->isInlineSpecified()); - Record.push_back(D->isVirtualAsWritten()); - Record.push_back(D->isPure()); - Record.push_back(D->hasInheritedPrototype()); - Record.push_back(D->hasWrittenPrototype()); - Record.push_back(D->isDeleted()); - Record.push_back(D->isTrivial()); - Record.push_back(D->isCopyAssignment()); - Record.push_back(D->hasImplicitReturnZero()); - Writer.AddSourceLocation(D->getLocEnd(), Record); - Record.push_back(D->getTemplatedKind()); switch (D->getTemplatedKind()) { default: assert(false && "Unhandled TemplatedKind!"); @@ -243,6 +225,7 @@ void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) { Writer.AddTemplateArgumentList(FTSInfo->TemplateArguments, Record); // Template args as written. + Record.push_back(FTSInfo->TemplateArgumentsAsWritten != 0); if (FTSInfo->TemplateArgumentsAsWritten) { Record.push_back(FTSInfo->TemplateArgumentsAsWritten->size()); for (int i=0, e = FTSInfo->TemplateArgumentsAsWritten->size(); i!=e; ++i) @@ -252,8 +235,6 @@ void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) { Record); Writer.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->getRAngleLoc(), Record); - } else { - Record.push_back(0); } break; } @@ -274,6 +255,26 @@ void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) { } } + // Make sure no Exprs are emitted after the body, because when reading the + // function, the body doesn't get read so the cursor doesn't advance. + Record.push_back(D->isThisDeclarationADefinition()); + if (D->isThisDeclarationADefinition()) + Writer.AddStmt(D->getBody()); + + Writer.AddDeclRef(D->getPreviousDeclaration(), Record); + Record.push_back(D->getStorageClass()); // FIXME: stable encoding + Record.push_back(D->getStorageClassAsWritten()); + Record.push_back(D->isInlineSpecified()); + Record.push_back(D->isVirtualAsWritten()); + Record.push_back(D->isPure()); + Record.push_back(D->hasInheritedPrototype()); + Record.push_back(D->hasWrittenPrototype()); + Record.push_back(D->isDeleted()); + Record.push_back(D->isTrivial()); + Record.push_back(D->isCopyAssignment()); + Record.push_back(D->hasImplicitReturnZero()); + Writer.AddSourceLocation(D->getLocEnd(), Record); + Record.push_back(D->param_size()); for (FunctionDecl::param_iterator P = D->param_begin(), PEnd = D->param_end(); P != PEnd; ++P) |