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_ANALYSIS_SCALABLE_MODEL_ENTITYLINKAGE_H
10#define LLVM_CLANG_ANALYSIS_SCALABLE_MODEL_ENTITYLINKAGE_H
11
12#include "llvm/ADT/StringRef.h"
13#include "llvm/Support/raw_ostream.h"
14
15namespace clang::ssaf {
16
17/// Represents the linkage properties of an entity in the program model.
18///
19/// EntityLinkage captures whether an entity has no linkage, internal linkage,
20/// or external linkage, which determines its visibility and accessibility
21/// across translation units.
23 friend class SerializationFormat;
24 friend class TestFixture;
25
26public:
27 enum class LinkageType {
28 None, ///< local variables, function parameters
29 Internal, ///< static functions/variables, anonymous namespace
30 External ///< globally visible across translation units
31 };
32
33 constexpr explicit EntityLinkage(LinkageType L) : Linkage(L) {}
34
35 LinkageType getLinkage() const { return Linkage; }
36
37 bool operator==(const EntityLinkage &Other) const;
38 bool operator!=(const EntityLinkage &Other) const;
39
40private:
41 LinkageType Linkage;
42};
43
44/// Returns a string representation of the linkage type.
45llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
47
48llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
49 const EntityLinkage &Linkage);
50
51} // namespace clang::ssaf
52
53#endif // LLVM_CLANG_ANALYSIS_SCALABLE_MODEL_ENTITYLINKAGE_H
Represents the linkage properties of an entity in the program model.
@ None
local variables, function parameters
@ Internal
static functions/variables, anonymous namespace
@ External
globally visible across translation units
bool operator!=(const EntityLinkage &Other) const
LinkageType getLinkage() const
bool operator==(const EntityLinkage &Other) const
constexpr EntityLinkage(LinkageType L)
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const BuildNamespace &BN)
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:1746