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/ASTWriterStmt.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'clang/lib/Serialization/ASTWriterStmt.cpp') diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index 6f4abc44909..e66db435344 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -1835,9 +1835,11 @@ void ASTStmtWriter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) { void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) { VisitExpr(E); - Record.AddStmt(E->getTemporary()); - Record.AddDeclRef(E->getExtendingDecl()); - Record.push_back(E->getManglingNumber()); + Record.push_back(static_cast(E->getLifetimeExtendedTemporaryDecl())); + if (E->getLifetimeExtendedTemporaryDecl()) + Record.AddDeclRef(E->getLifetimeExtendedTemporaryDecl()); + else + Record.AddStmt(E->getSubExpr()); Code = serialization::EXPR_MATERIALIZE_TEMPORARY; } -- cgit v1.2.3