//===- Linkage.h - Linkage enumeration and utilities ------------*- 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 // //===----------------------------------------------------------------------===// // /// \file /// Defines the Linkage enumeration and various utility functions. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_LINKAGE_H #define LLVM_CLANG_BASIC_LINKAGE_H #include "llvm/Support/ErrorHandling.h" #include <utility> namespace clang { /// Describes the different kinds of linkage /// (C++ [basic.link], C99 6.2.2) that an entity may have. enum class Linkage : unsigned char { … }; /// Describes the different kinds of language linkage /// (C++ [dcl.link]) that an entity may have. enum LanguageLinkage { … }; /// A more specific kind of linkage than enum Linkage. /// /// This is relevant to CodeGen and AST file reading. enum GVALinkage { … }; inline bool isDiscardableGVALinkage(GVALinkage L) { … } /// Do we know that this will be the only definition of this symbol (excluding /// inlining-only definitions)? inline bool isUniqueGVALinkage(GVALinkage L) { … } inline bool isExternallyVisible(Linkage L) { … } inline Linkage getFormalLinkage(Linkage L) { … } inline bool isExternalFormalLinkage(Linkage L) { … } /// Compute the minimum linkage given two linkages. /// /// The linkage can be interpreted as a pair formed by the formal linkage and /// a boolean for external visibility. This is just what getFormalLinkage and /// isExternallyVisible return. We want the minimum of both components. The /// Linkage enum is defined in an order that makes this simple, we just need /// special cases for when VisibleNoLinkage would lose the visible bit and /// become NoLinkage. inline Linkage minLinkage(Linkage L1, Linkage L2) { … } } // namespace clang #endif // LLVM_CLANG_BASIC_LINKAGE_H