================
@@ -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);
----------------
aviralg wrote:
Can we rename this to `addSummary`. We don't use `fact` anywhere else and we
should avoid introducing new terminology if possible.
https://github.com/llvm/llvm-project/pull/181220
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits