[clang] NRVO: Improvements and handling of more cases.
authorMatheus Izvekov <mizvekov@gmail.com>
Fri, 19 Mar 2021 02:32:06 +0000 (03:32 +0100)
committerMatheus Izvekov <mizvekov@gmail.com>
Thu, 10 Jun 2021 21:02:51 +0000 (23:02 +0200)
commit667fbcdd0b2ee5e78f5ce9789b862e3bbca94644
tree30d861816554be207a9f429c8fb8a629bee51036
parent5d5b686f6bf6b15b8fbd9ccf957295397f27afc9
[clang] NRVO: Improvements and handling of more cases.

This expands NRVO propagation for more cases:

Parse analysis improvement:
* Lambdas and Blocks with dependent return type can have their variables
  marked as NRVO Candidates.

Variable instantiation improvements:
* Fixes crash when instantiating NRVO variables in Blocks.
* Functions, Lambdas, and Blocks which have auto return type have their
  variables' NRVO status propagated. For Blocks with non-auto return type,
  as a limitation, this propagation does not consider the actual return
  type.

This also implements exclusion of VarDecls which are references to
dependent types.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: Quuxplusone

Differential Revision: https://reviews.llvm.org/D99696
clang/include/clang/Sema/Sema.h
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaCoroutine.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaStmt.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/CodeGen/nrvo-tracking.cpp