clang 23.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_SCALABLESTATICANALYSISFRAMEWORK_CORE_MODEL_ENTITYNAME_H
10#define LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_MODEL_ENTITYNAME_H
11
13#include "llvm/ADT/SmallString.h"
14#include "llvm/ADT/StringRef.h"
15#include "llvm/Support/raw_ostream.h"
16#include <string>
17
18namespace clang::ssaf {
19/// Uniquely identifies an entity in a program.
20///
21/// EntityName provides a globally unique identifier for program entities that
22/// remains stable across compilation boundaries. This enables whole-program
23/// analysis to track and relate entities across separately compiled translation
24/// units.
25///
26/// Client code should not make assumptions about the implementation details,
27/// such as USRs.
29 friend class EntityLinker;
30 friend class SerializationFormat;
31 friend class TestFixture;
32 friend llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
33 const EntityName &EN);
34
35 std::string USR;
37 NestedBuildNamespace Namespace;
38
39 auto asTuple() const { return std::tie(USR, Suffix, Namespace); }
40
41public:
42 /// Client code should not use this constructor directly.
43 /// Use getEntityName and other functions in ASTEntityMapping.h to get
44 /// entity names.
45 EntityName(llvm::StringRef USR, llvm::StringRef Suffix,
46 NestedBuildNamespace Namespace);
47
48 bool operator==(const EntityName &Other) const;
49 bool operator!=(const EntityName &Other) const;
50 bool operator<(const EntityName &Other) const;
51
52 /// Creates a new EntityName with additional build namespace qualification.
53 ///
54 /// \param Namespace The namespace steps to append to this entity's namespace.
56};
57
58llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const EntityName &EN);
59
60} // namespace clang::ssaf
61
62#endif // LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_MODEL_ENTITYNAME_H
Uniquely identifies an entity in a program.
Definition EntityName.h:28
bool operator==(const EntityName &Other) const
friend class EntityLinker
Definition EntityName.h:29
EntityName(llvm::StringRef USR, llvm::StringRef Suffix, NestedBuildNamespace Namespace)
Client code should not use this constructor directly.
friend class SerializationFormat
Definition EntityName.h:30
EntityName makeQualified(NestedBuildNamespace Namespace) const
Creates a new EntityName with additional build namespace qualification.
friend class TestFixture
Definition EntityName.h:31
bool operator!=(const EntityName &Other) const
friend llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const EntityName &EN)
bool operator<(const EntityName &Other) const
Represents a hierarchical sequence of build namespaces.
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, BuildNamespaceKind BNK)
@ Other
Other implicit parameter.
Definition Decl.h:1746