[clang] [clang][dataflow] Fix crash when analyzing a coroutine (PR #85957)
Eric Li via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 20 09:40:08 PDT 2024
================
@@ -4628,6 +4662,21 @@ TEST(TransferTest, DoesNotCrashOnUnionThisExpr) {
LangStandard::lang_cxx17, /*ApplyBuiltinTransfer=*/true, "operator=");
}
+TEST(TransferTest, DoesNotCrashOnNullChildren) {
+ std::string Code = (CoroutineLibrary + R"cc(
+ task foo() noexcept {
+ co_return;
+ }
+ )cc").str();
+ // This is a crash regression test when calling `AdornedCFG::build` on a
+ // statement (in this case, the `CoroutineBodyStmt`) with null children.
+ runDataflow(
+ Code,
+ [](const llvm::StringMap<DataflowAnalysisState<NoopLattice>> &,
+ ASTContext &) {},
+ LangStandard::lang_cxx20, /*ApplyBuiltinTransfer=*/true, "foo");
----------------
tJener wrote:
Done.
https://github.com/llvm/llvm-project/pull/85957
More information about the cfe-commits
mailing list