From b0561b3346e7bf0ae974995ca95b917eebde18e1 Mon Sep 17 00:00:00 2001 From: Tyker Date: Sun, 17 Nov 2019 11:41:55 +0100 Subject: [NFC] Refactor representation of materialized temporaries Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: thakis, sammccall, ilya-biryukov, rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360 --- clang/lib/Serialization/ASTWriterDecl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'clang/lib/Serialization/ASTWriterDecl.cpp') diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index b9ee8e81719..51902a607ca 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -124,6 +124,7 @@ namespace clang { void VisitBlockDecl(BlockDecl *D); void VisitCapturedDecl(CapturedDecl *D); void VisitEmptyDecl(EmptyDecl *D); + void VisitLifetimeExtendedTemporaryDecl(LifetimeExtendedTemporaryDecl *D); void VisitDeclContext(DeclContext *DC); template void VisitRedeclarable(Redeclarable *D); @@ -1134,6 +1135,17 @@ void ASTDeclWriter::VisitEmptyDecl(EmptyDecl *D) { Code = serialization::DECL_EMPTY; } +void ASTDeclWriter::VisitLifetimeExtendedTemporaryDecl( + LifetimeExtendedTemporaryDecl *D) { + VisitDecl(D); + Record.AddDeclRef(D->getExtendingDecl()); + Record.AddStmt(D->getTemporaryExpr()); + Record.push_back(static_cast(D->getValue())); + if (D->getValue()) + Record.AddAPValue(*D->getValue()); + Record.push_back(D->getManglingNumber()); + Code = serialization::DECL_LIFETIME_EXTENDED_TEMPORARY; +} void ASTDeclWriter::VisitBlockDecl(BlockDecl *D) { VisitDecl(D); Record.AddStmt(D->getBody()); -- cgit v1.2.3