diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-05-11 05:45:24 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-05-11 05:45:24 +0000 |
| commit | 9dadfab2faebe40e7dbbfd0801c15174b69bd726 (patch) | |
| tree | 59cd6186adc8250cc68c97b511aa6fc0bb82b594 /lib/Serialization/ASTWriter.cpp | |
| parent | e8065128777e13322aa2b4de86a362326e0c7686 (diff) | |
| download | clang-9dadfab2faebe40e7dbbfd0801c15174b69bd726.tar.gz clang-9dadfab2faebe40e7dbbfd0801c15174b69bd726.tar.bz2 clang-9dadfab2faebe40e7dbbfd0801c15174b69bd726.tar.xz | |
C++1y deduced return types: when we deduce a return type for a function which
we loaded from PCH, if we're building another PCH, create an update record to
patch the return type of the earlier declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181659 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
| -rw-r--r-- | lib/Serialization/ASTWriter.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index a96ecd7b86..dd5818f843 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -4230,10 +4230,16 @@ void ASTWriter::ResolveDeclUpdatesBlocks() { URec[Idx] = GetDeclRef(reinterpret_cast<Decl *>(URec[Idx])); ++Idx; break; - + case UPD_CXX_INSTANTIATED_STATIC_DATA_MEMBER: ++Idx; break; + + case UPD_CXX_DEDUCED_RETURN_TYPE: + URec[Idx] = GetOrCreateTypeID( + QualType::getFromOpaquePtr(reinterpret_cast<void *>(URec[Idx]))); + ++Idx; + break; } } } @@ -4448,11 +4454,13 @@ void ASTWriter::AddTypeRef(QualType T, RecordDataImpl &Record) { } TypeID ASTWriter::GetOrCreateTypeID( QualType T) { + assert(Context); return MakeTypeID(*Context, T, std::bind1st(std::mem_fun(&ASTWriter::GetOrCreateTypeIdx), this)); } TypeID ASTWriter::getTypeID(QualType T) const { + assert(Context); return MakeTypeID(*Context, T, std::bind1st(std::mem_fun(&ASTWriter::getTypeIdx), this)); } @@ -5189,6 +5197,17 @@ void ASTWriter::AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, Record.push_back(reinterpret_cast<uint64_t>(D)); } +void ASTWriter::DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) { + assert(!WritingAST && "Already writing the AST!"); + FD = FD->getCanonicalDecl(); + if (!FD->isFromASTFile()) + return; // Not a function declared in PCH and defined outside. + + UpdateRecord &Record = DeclUpdates[FD]; + Record.push_back(UPD_CXX_DEDUCED_RETURN_TYPE); + Record.push_back(reinterpret_cast<uint64_t>(ReturnType.getAsOpaquePtr())); +} + void ASTWriter::CompletedImplicitDefinition(const FunctionDecl *D) { assert(!WritingAST && "Already writing the AST!"); if (!D->isFromASTFile()) |
