Fix codegen for coroutine with function-try-block
authorMatthias Braun <matze@braunis.de>
Thu, 23 Mar 2023 20:38:16 +0000 (13:38 -0700)
committerMatthias Braun <matze@braunis.de>
Thu, 30 Mar 2023 18:16:32 +0000 (11:16 -0700)
commite00a8d081d789cac606cf0749c332c4632132820
tree106e860177fc49d85df5146eda1ba1576193bdef
parent3b919a5e01ef35caa24fe3a4ccc3dd459e56449b
Fix codegen for coroutine with function-try-block

This fixes an assertion error when writing a coroutine with a
function-try-block. In this case the function body is not a
`CompoundStmt` so the code constructing an artificial CXXTryStmt must
also construct a `CompoundStmt` for it.

While on it adjust the `CXXStmt::Create` function to only accept
`CompoundStmt*`.

Differential Revision: https://reviews.llvm.org/D146758
clang/include/clang/AST/StmtCXX.h
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/StmtCXX.cpp
clang/lib/CodeGen/CGCoroutine.cpp
clang/lib/Sema/SemaStmt.cpp
clang/test/CodeGenCoroutines/coro-function-try-block.cpp [new file with mode: 0644]