[clang] [SSAF][Extractor] Make hard errors in Extractors quiet (PR #201953)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 8 00:44:50 PDT 2026
================
@@ -1126,4 +1127,51 @@ TEST_F(PointerFlowTest, NestedLambdaAssign) {
ASSERT_NE(Sum, nullptr);
EXPECT_EQ(*Sum, makeEdges(__LINE__, {{{"y", 1U}, {"x", 1U}}}));
}
+
+//////////////////////////////////////////////////////////////
+// Robustness Tests (No Crash Tests) //
+//////////////////////////////////////////////////////////////
+
+TEST_F(PointerFlowTest, StructuredBindingWithPointers) {
+ StringRef Code = R"cpp(
+ void foo() {
+ int *a[2];
+ auto [ptr1, ptr2] = a;
+ ptr1[5];
+ ptr2[3];
+ }
+ )cpp";
+
+ // BindingDecl may not be fully supported, but should not crash
+ llvm::DebugFlag = true;
+ llvm::setCurrentDebugType("ssaf-analyses");
+ testing::internal::CaptureStderr();
+
+ ASSERT_EQ(setUpTest(Code), true);
+
+ std::string Output = testing::internal::GetCapturedStderr();
+ llvm::DebugFlag = false;
----------------
steakhal wrote:
Use a scope-exit to ensure that DebugFlag is unset even if the test fails (and basically aborts at `ASSERT_EQ(setUpTest(Code), true);` Same applies to the other test case.
That said, you should use `ASSERT_TRUE(setUpTest(Code))` instead.
https://github.com/llvm/llvm-project/pull/201953
More information about the cfe-commits
mailing list