================
@@ -0,0 +1,40 @@
+//===- EntityIdTable.cpp ----------------------------------------*- C++ 
-*-===//
+//
+// 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/Model/EntityIdTable.h"
+#include <cassert>
+
+namespace clang {
+namespace ssaf {
+
+EntityId EntityIdTable::getId(const EntityName &Name) {
+  const auto It = Entities.find(Name);
+  if (It == Entities.end()) {
+    EntityId Id(Entities.size());
+    Entities.emplace(Name, Id);
+    return Id;
+  }
+
+  return It->second;
+}
+
+bool EntityIdTable::exists(const EntityName &Name) const {
+  return Entities.find(Name) != Entities.end();
+}
+
+void EntityIdTable::forEach(
+    std::function<void(const EntityName &, EntityId)> Callback) const {
----------------
Xazax-hun wrote:

This function does not escape the scope. Should this be an `llvm::function_ref` 
instead?

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

Reply via email to