[clang] [clang][ssaf] Implement TUSummaryBuilder with test infrastructure (PR #181220)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 17 06:00:21 PST 2026
================
@@ -9,10 +9,36 @@
#ifndef LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_TUSUMMARYBUILDER_H
#define LLVM_CLANG_ANALYSIS_SCALABLE_TUSUMMARY_TUSUMMARYBUILDER_H
+#include <memory>
+#include <utility>
+
namespace clang::ssaf {
+class EntityId;
+class EntityName;
+class EntitySummary;
+class TUSummary;
+
class TUSummaryBuilder {
- // Empty for now.
+public:
+ explicit TUSummaryBuilder(TUSummary &Summary) : Summary(Summary) {}
+
+ /// Add an entity to the summary and return its EntityId.
+ /// If the entity already exists, returns the existing ID (idempotent).
+ EntityId addEntity(const EntityName &E);
+
+ /// Associate a \p Data EntitySummary with the \p Entity.
+ /// This consumes the \p Data only if \p Entity wasn't associated yet with the
+ /// same kind of EntitySummary.
+ /// \returns a pointer to the EntitySummary and whether it inserted or not.
+ /// \note Be sure to pass exactly an expression of type
+ /// \sa std::unique_ptr<EntitySummary>, otherwise the conversion operator will
+ /// automatically consume the \p Data.
+ std::pair<EntitySummary *, bool>
+ addFact(EntityId Entity, std::unique_ptr<EntitySummary> &&Data);
----------------
steakhal wrote:
Opted for `addSummary` in d78514cdc1489
https://github.com/llvm/llvm-project/pull/181220
More information about the cfe-commits
mailing list