================ @@ -0,0 +1,47 @@ +//===- EntityName.h ---------------------------------------------*- 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_ANALYSIS_SCALABLE_ENTITY_NAME_H +#define LLVM_CLANG_ANALYSIS_SCALABLE_ENTITY_NAME_H + +#include "clang/Analysis/Scalable/Model/BuildNamespace.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringRef.h" +#include <string> + +namespace clang { +namespace ssaf { + +/// Uniquely identifies an entity in a program. +/// +/// EntityName provides a globally unique identifier for program entities that remains +/// stable across compilation boundaries. This enables whole-program analysis to track +/// and relate entities across separately compiled translation units. +class EntityName { + std::string USR; + llvm::SmallString<16> Suffix; + NestedBuildNamespace Namespace; ---------------- jkorous-apple wrote:
My plan is to actually use 64-bit IDs to represent entities in most contexts. A follow-up PR introduces that: https://github.com/jkorous-apple/llvm-project/pull/1 I imagine `EntityName` will mostly be used for linking and for mapping entities back to the AST which we need for source code rewriting tools. The compilation unit IDs and link unit IDs that the namespaces use as names will be supplied to the framework by external tools. We imagine the implementation will need to be space-efficient and while this API doesn't impose such restriction, it is unlikely that we could use long strings. With the current API design (with `EntityIdTable`), during summary extraction, we would still have an instance of `EntityName` for each entity contributing a fact or being referred to by a summary. I plan to factor out the common namespace prefix with compilation unit id and have individual entity names unqualified. For summary analysis part, when we might need to represent all entities of a program in memory at once, having even a single instance of EntityName for each entity in memory might be impossible for large programs. If that turns out to be true we might need a different representation than `EntityName`, `EntityId` and `EntityIdTable`. https://github.com/llvm/llvm-project/pull/169131 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
