[AST][RecoveryExpr] Fix the value category for recovery expr.
authorHaojian Wu <hokein.wu@gmail.com>
Wed, 8 Jul 2020 11:53:47 +0000 (13:53 +0200)
committerHaojian Wu <hokein.wu@gmail.com>
Wed, 8 Jul 2020 11:55:07 +0000 (13:55 +0200)
commit96a5cfff208d8e86a598e64412d9ef5dde0f9c9e
treef4bd7db24934776e69d1b4a90b44c7a3dd185a99
parent695b33a56919af8873eecb47cb83fa17a271e99f
[AST][RecoveryExpr] Fix the value category for recovery expr.

RecoveryExpr was always lvalue, but it is wrong if we use it to model
broken function calls, function call expression has more compliated rules:

- a call to a function whose return type is an lvalue reference yields an lvalue;
- a call to a function whose return type is an rvalue reference yields an xvalue;
- a call to a function whose return type is nonreference type yields a prvalue;

This patch makes the recovery-expr align with the function call if it is
modeled a broken call.

Differential revision: https://reviews.llvm.org/D83201
clang/lib/AST/Expr.cpp
clang/lib/AST/ExprClassification.cpp
clang/lib/Sema/SemaOverload.cpp
clang/test/AST/ast-dump-recovery.cpp
clang/test/SemaCXX/recovery-expr-type.cpp