@@ -131,6 +131,12 @@ class Converter : public clang::RecursiveASTVisitor<Converter> {
131131
132132 virtual void EmitFunctionPreamble (clang::FunctionDecl *decl);
133133
134+ // Declares the storage of the temporary temp that the default argument of
135+ // param is bound to, and returns its name.
136+ std::string
137+ EmitDefaultArgStorage (const clang::ParmVarDecl *param,
138+ const clang::MaterializeTemporaryExpr *temp);
139+
134140 virtual void ConvertFunctionBody (clang::FunctionDecl *decl);
135141
136142 void ConvertGotoBlock (clang::CompoundStmt *body);
@@ -381,6 +387,9 @@ class Converter : public clang::RecursiveASTVisitor<Converter> {
381387 ConvertLambdaToFunctionPointer (clang::Expr *lambda,
382388 const clang::CXXConversionDecl *conversion);
383389
390+ void EmitLambdaFunctionPointer (const clang::CXXRecordDecl *lambda,
391+ clang::CXXMethodDecl *call_operator);
392+
384393 virtual void
385394 ConvertFunctionToFunctionPointer (const clang::FunctionDecl *fn_decl);
386395
@@ -458,6 +467,10 @@ class Converter : public clang::RecursiveASTVisitor<Converter> {
458467
459468 virtual void ConvertBinaryOperator (clang::BinaryOperator *expr);
460469
470+ // The value that the compound assignment expr assigns to its left operand,
471+ // whose type differs from the computation type.
472+ std::string ConvertCompoundAssignValue (clang::CompoundAssignOperator *expr);
473+
461474 virtual bool ConvertIncAndDec (clang::UnaryOperator *expr);
462475
463476 virtual bool VisitUnaryOperator (clang::UnaryOperator *expr);
@@ -487,6 +500,12 @@ class Converter : public clang::RecursiveASTVisitor<Converter> {
487500 virtual bool VisitCXXThisExpr (clang::CXXThisExpr *expr);
488501
489502 virtual bool VisitInitListExpr (clang::InitListExpr *expr);
503+ virtual void ConvertScalarInitList (clang::InitListExpr *expr);
504+ // is_empty: whether the list, as written, has no initializers.
505+ virtual void ConvertRecordInitList (clang::InitListExpr *expr, bool is_empty);
506+ virtual void ConvertUnionInitList (clang::InitListExpr *expr,
507+ const clang::FieldDecl *field);
508+ virtual void ConvertArrayInitList (clang::InitListExpr *expr);
490509 bool VisitOpaqueValueExpr (clang::OpaqueValueExpr *expr);
491510 bool VisitArrayInitIndexExpr (clang::ArrayInitIndexExpr *expr);
492511 virtual bool VisitArrayInitLoopExpr (clang::ArrayInitLoopExpr *expr);
@@ -1037,28 +1056,28 @@ class Converter : public clang::RecursiveASTVisitor<Converter> {
10371056 }
10381057 };
10391058
1059+ // Whether the converted expression evaluates to a new value, which can be
1060+ // moved, rather than to an existing one, which must be copied.
10401061 enum class ComputedExprType : uint8_t {
1041- Value,
1042- FreshValue,
1043- Pointer,
1044- FreshPointer,
1062+ Fresh,
1063+ NotFresh,
10451064 Unknown,
10461065 Pending,
10471066 };
10481067 ComputedExprType computed_expr_type_ = ComputedExprType::Unknown;
10491068
10501069 bool isFresh () const {
1051- assert (computed_expr_type_ != ComputedExprType::Unknown);
1052- assert (computed_expr_type_ != ComputedExprType::Pending);
1053- return computed_expr_type_ == ComputedExprType::FreshValue ||
1054- computed_expr_type_ == ComputedExprType::FreshPointer;
1070+ return computed_expr_type_ == ComputedExprType::Fresh;
10551071 }
10561072
1057- void SetFresh ();
1073+ void MarkFresh () { computed_expr_type_ = ComputedExprType::Fresh; }
1074+ void MarkNotFresh () { computed_expr_type_ = ComputedExprType::NotFresh; }
1075+ // Emits str, which evaluates to a new value.
1076+ void EmitFresh (std::string_view str);
10581077 // str, cloned unless the expression it was converted from is fresh.
10591078 std::string MakeFresh (std::string str);
1079+ // A read of a value of the given type is fresh if the value is copied.
10601080 void SetValueFreshness (clang::QualType type);
1061- void SetFreshType (clang::QualType type);
10621081
10631082 std::string ConvertLValue (clang::Expr *expr);
10641083 std::string
0 commit comments