[clang] disable implicit moves when not in CPlusPLus
authorMatheus Izvekov <mizvekov@gmail.com>
Sat, 11 Sep 2021 23:11:02 +0000 (01:11 +0200)
committerMatheus Izvekov <mizvekov@gmail.com>
Tue, 14 Sep 2021 09:29:47 +0000 (11:29 +0200)
commit2d6829bbbe6877920d9be1db93b9f3fc85b43d10
tree1eeba9dbeed39e179d67c97026c6e2a77a3fab42
parentf28740541942ea4d68b968af279bcd6793732f00
[clang] disable implicit moves when not in CPlusPLus

See PR51842.

This fixes an assert firing in the static analyzer, triggered by implicit moves
in blocks in C mode:

This also simplifies the AST a little bit when compiling non C++ code,
as the xvalue implicit casts are not inserted.

We keep and test that the nrvo flag is still being set on the VarDecls,
as that is still a bit beneficial while not really making anything
more complicated.

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

Differential Revision: https://reviews.llvm.org/D109654
clang/lib/Sema/SemaStmt.cpp
clang/test/AST/nrvo.c [new file with mode: 0644]
clang/test/Analysis/blocks-nrvo.c [new file with mode: 0644]