//===--- Specifiers.h - Declaration and Type Specifiers ---------*- 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 various enumerations that describe declaration and /// type specifiers. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_SPECIFIERS_H #define LLVM_CLANG_BASIC_SPECIFIERS_H #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/ErrorHandling.h" namespace llvm { class raw_ostream; } // namespace llvm namespace clang { /// Define the meaning of possible values of the kind in ExplicitSpecifier. enum class ExplicitSpecKind : unsigned { … }; /// Define the kind of constexpr specifier. enum class ConstexprSpecKind { … }; /// In an if statement, this denotes whether the statement is /// a constexpr or consteval if statement. enum class IfStatementKind : unsigned { … }; /// Specifies the width of a type, e.g., short, long, or long long. enum class TypeSpecifierWidth { … }; /// Specifies the signedness of a type, e.g., signed or unsigned. enum class TypeSpecifierSign { … }; enum class TypeSpecifiersPipe { … }; /// Specifies the kind of type. enum TypeSpecifierType { … }; /// Structure that packs information about the type specifiers that /// were written in a particular type specifier sequence. struct WrittenBuiltinSpecs { … }; /// A C++ access specifier (public, private, protected), plus the /// special value "none" which means different things in different contexts. enum AccessSpecifier { … }; /// The categorization of expression values, currently following the /// C++11 scheme. enum ExprValueKind { … }; /// A further classification of the kind of object referenced by an /// l-value or x-value. enum ExprObjectKind { … }; /// The reason why a DeclRefExpr does not constitute an odr-use. enum NonOdrUseReason { … }; /// Describes the kind of template specialization that a /// particular template specialization declaration represents. enum TemplateSpecializationKind { … }; /// Determine whether this template specialization kind refers /// to an instantiation of an entity (as opposed to a non-template or /// an explicit specialization). inline bool isTemplateInstantiation(TemplateSpecializationKind Kind) { … } /// True if this template specialization kind is an explicit /// specialization, explicit instantiation declaration, or explicit /// instantiation definition. inline bool isTemplateExplicitInstantiationOrSpecialization( TemplateSpecializationKind Kind) { … } /// Thread storage-class-specifier. enum ThreadStorageClassSpecifier { … }; /// Storage classes. enum StorageClass { … }; /// Checks whether the given storage class is legal for functions. inline bool isLegalForFunction(StorageClass SC) { … } /// Checks whether the given storage class is legal for variables. inline bool isLegalForVariable(StorageClass SC) { … } /// In-class initialization styles for non-static data members. enum InClassInitStyle { … }; /// CallingConv - Specifies the calling convention that a function uses. enum CallingConv { … }; /// Checks whether the given calling convention supports variadic /// calls. Unprototyped calls also use the variadic call rules. inline bool supportsVariadicCall(CallingConv CC) { … } /// The storage duration for an object (per C++ [basic.stc]). enum StorageDuration { … }; /// Describes the nullability of a particular type. enum class NullabilityKind : uint8_t { … }; /// Prints human-readable debug representation. llvm::raw_ostream &operator<<(llvm::raw_ostream&, NullabilityKind); /// Return true if \p L has a weaker nullability annotation than \p R. The /// ordering is: Unspecified < Nullable < NonNull. inline bool hasWeakerNullability(NullabilityKind L, NullabilityKind R) { … } /// Retrieve the spelling of the given nullability kind. llvm::StringRef getNullabilitySpelling(NullabilityKind kind, bool isContextSensitive = false); /// Kinds of parameter ABI. enum class ParameterABI { … }; /// Assigned inheritance model for a class in the MS C++ ABI. Must match order /// of spellings in MSInheritanceAttr. enum class MSInheritanceModel { … }; llvm::StringRef getParameterABISpelling(ParameterABI kind); inline llvm::StringRef getAccessSpelling(AccessSpecifier AS) { … } } // end namespace clang #endif // LLVM_CLANG_BASIC_SPECIFIERS_H