================ @@ -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); ---------------- Xazax-hun wrote:
Nit: maybe via the try_emplace API we could avoid doing 2 lookups when we do the insertion. https://github.com/llvm/llvm-project/pull/171660 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
