clang 22.0.0git
EntityName.h
Go to the documentation of this file.
1//===- EntityName.h ---------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_ANALYSIS_SCALABLE_MODEL_ENTITYNAME_H
10#define LLVM_CLANG_ANALYSIS_SCALABLE_MODEL_ENTITYNAME_H
11
13#include "llvm/ADT/SmallString.h"
14#include "llvm/ADT/StringRef.h"
15#include <string>
16
17namespace clang::ssaf {
18/// Uniquely identifies an entity in a program.
19///
20/// EntityName provides a globally unique identifier for program entities that
21/// remains stable across compilation boundaries. This enables whole-program
22/// analysis to track and relate entities across separately compiled translation
23/// units.
24///
25/// Client code should not make assumptions about the implementation details,
26/// such as USRs.
28 std::string USR;
30 NestedBuildNamespace Namespace;
31
32 auto asTuple() const { return std::tie(USR, Suffix, Namespace); }
33
34public:
35 /// Client code should not use this constructor directly.
36 /// Use getEntityName and other functions in ASTEntityMapping.h to get
37 /// entity names.
38 EntityName(llvm::StringRef USR, llvm::StringRef Suffix,
39 NestedBuildNamespace Namespace);
40
41 bool operator==(const EntityName &Other) const;
42 bool operator!=(const EntityName &Other) const;
43 bool operator<(const EntityName &Other) const;
44
45 /// Creates a new EntityName with additional build namespace qualification.
46 ///
47 /// \param Namespace The namespace steps to append to this entity's namespace.
49
50 friend class LinkUnitResolution;
51 friend class SerializationFormat;
52};
53
54} // namespace clang::ssaf
55
56#endif // LLVM_CLANG_ANALYSIS_SCALABLE_MODEL_ENTITYNAME_H
bool operator==(const EntityName &Other) const
EntityName(llvm::StringRef USR, llvm::StringRef Suffix, NestedBuildNamespace Namespace)
Client code should not use this constructor directly.
friend class SerializationFormat
Definition EntityName.h:51
EntityName makeQualified(NestedBuildNamespace Namespace) const
Creates a new EntityName with additional build namespace qualification.
bool operator!=(const EntityName &Other) const
bool operator<(const EntityName &Other) const
friend class LinkUnitResolution
Definition EntityName.h:50
Represents a hierarchical sequence of build namespaces.
@ Other
Other implicit parameter.
Definition Decl.h:1746