[clang] [clang][ssaf] Add UnsafeBufferUsage summary data structures (PR #181067)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 16 07:21:55 PST 2026


================
@@ -0,0 +1,95 @@
+//===------- unittests/Analysis/Scalable/UnsafeBufferUsageTest.cpp --------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Analysis/Scalable/Analyses/UnsafeBufferUsage/UnsafeBufferUsage.h"
+#include "clang/Analysis/Scalable/Model/EntityId.h"
+#include "clang/Analysis/Scalable/Model/EntityIdTable.h"
+#include "gtest/gtest.h"
+#include <memory>
+
+using namespace clang;
+using namespace ssaf;
+
+namespace {
+
+class UnsafeBufferUsageTest : public testing::Test {
+protected:
+  EntityIdTable Table;
+  UnsafeBufferUsageTUSummaryBuilder Builder;
+};
+
+//////////////////////////////////////////////////////////////
+//                   Data Structure Tests                   //
+//////////////////////////////////////////////////////////////
+
+#define EXPECT_CONTAINS(Set, Elt) EXPECT_NE((Set)->find(Elt), (Set)->end());
+#define EXPECT_EXCLUDES(Set, Elt) EXPECT_EQ((Set)->find(Elt), (Set)->end());
----------------
steakhal wrote:

I also think that these should expect reference (not pointers).

https://github.com/llvm/llvm-project/pull/181067


More information about the cfe-commits mailing list