================
@@ -0,0 +1,17 @@
+#include "clang/Analysis/Scalable/TUSummary/TUSummaryBuilder.h"
+#include "clang/Analysis/Scalable/Model/EntityId.h"
+#include "clang/Analysis/Scalable/TUSummary/TUSummary.h"
+#include <memory>
+
+using namespace clang;
+using namespace ssaf;
+
+EntityId TUSummaryBuilder::addEntity(const EntityName &E) {
+  return Summary.IdTable.getId(E);
+}
+
+void TUSummaryBuilder::addFact(EntityId ContributingEntity,
+                               std::unique_ptr<EntitySummary> NewData) {
+  Summary.Data[NewData->getSummaryName()][ContributingEntity] =
+      std::move(NewData);
+}
----------------
steakhal wrote:

There is no easy way of checking this precondition. Maybe something like this 
would work:
```c++
#if defined(EXPENSIVE_CHECKS) && defined(DEBUG)
  bool Exists = false;
  Summary.IdTable.forEach([&](const EntityName &, EntityId ID) {
    Exists |= ID == ContributingEntity;
  });
  assert(Exists);
#endif
```

https://github.com/llvm/llvm-project/pull/181220
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to