clang 23.0.0git
EntityLinkage.h
Go to the documentation of this file.
1//===- EntityLinkage.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_SCALABLESTATICANALYSIS_CORE_MODEL_ENTITYLINKAGE_H
10#define LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_MODEL_ENTITYLINKAGE_H
11
12#include "llvm/ADT/StringRef.h"
13#include "llvm/Support/raw_ostream.h"
14
15namespace clang::ssaf {
16
18 None, ///< local variables
19 Internal, ///< static functions/variables, anonymous namespace
20 External ///< globally visible across translation units (including parameters
21 ///< of functions with external linkage)
22};
23
24/// Represents the linkage properties of an entity in the program model.
25///
26/// EntityLinkage captures whether an entity has no linkage, internal linkage,
27/// or external linkage, which determines its visibility and accessibility
28/// across translation units.
30 friend class SerializationFormat;
31 friend class TestFixture;
32
33public:
34 constexpr explicit EntityLinkage(EntityLinkageType L) : Linkage(L) {}
35
36 EntityLinkageType getLinkage() const { return Linkage; }
37
38 bool operator==(const EntityLinkage &Other) const;
39 bool operator!=(const EntityLinkage &Other) const;
40
41private:
43};
44
45/// Writes a string representation of the linkage type to the stream.
46llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, EntityLinkageType Linkage);
47
48llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
49 const EntityLinkage &Linkage);
50
51} // namespace clang::ssaf
52
53#endif // LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_MODEL_ENTITYLINKAGE_H
Represents the linkage properties of an entity in the program model.
bool operator!=(const EntityLinkage &Other) const
constexpr EntityLinkage(EntityLinkageType L)
EntityLinkageType getLinkage() const
bool operator==(const EntityLinkage &Other) const
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, BuildNamespaceKind BNK)
@ Internal
static functions/variables, anonymous namespace
@ External
globally visible across translation units (including parameters of functions with external linkage)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition Linkage.h:24
@ Other
Other implicit parameter.
Definition Decl.h:1772