//===--- DeclSpec.h - Parsed declaration 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 /// This file defines the classes used to store parsed information about /// declaration-specifiers and declarators. /// /// \verbatim /// static const int volatile x, *y, *(*(*z)[10])(const void *x); /// ------------------------- - -- --------------------------- /// declaration-specifiers \ | / /// declarators /// \endverbatim /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_SEMA_DECLSPEC_H #define LLVM_CLANG_SEMA_DECLSPEC_H #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjCCommon.h" #include "clang/AST/NestedNameSpecifier.h" #include "clang/Basic/ExceptionSpecificationType.h" #include "clang/Basic/Lambda.h" #include "clang/Basic/OperatorKinds.h" #include "clang/Basic/Specifiers.h" #include "clang/Lex/Token.h" #include "clang/Sema/Ownership.h" #include "clang/Sema/ParsedAttr.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include <optional> namespace clang { class ASTContext; class CXXRecordDecl; class TypeLoc; class LangOptions; class IdentifierInfo; class NamespaceAliasDecl; class NamespaceDecl; class ObjCDeclSpec; class Sema; class Declarator; struct TemplateIdAnnotation; /// Represents a C++ nested-name-specifier or a global scope specifier. /// /// These can be in 3 states: /// 1) Not present, identified by isEmpty() /// 2) Present, identified by isNotEmpty() /// 2.a) Valid, identified by isValid() /// 2.b) Invalid, identified by isInvalid(). /// /// isSet() is deprecated because it mostly corresponded to "valid" but was /// often used as if it meant "present". /// /// The actual scope is described by getScopeRep(). /// /// If the kind of getScopeRep() is TypeSpec then TemplateParamLists may be empty /// or contain the template parameter lists attached to the current declaration. /// Consider the following example: /// template <class T> void SomeType<T>::some_method() {} /// If CXXScopeSpec refers to SomeType<T> then TemplateParamLists will contain /// a single element referring to template <class T>. class CXXScopeSpec { … }; /// Captures information about "declaration specifiers". /// /// "Declaration specifiers" encompasses storage-class-specifiers, /// type-specifiers, type-qualifiers, and function-specifiers. class DeclSpec { … }; /// Captures information about "declaration specifiers" specific to /// Objective-C. class ObjCDeclSpec { … }; /// Describes the kind of unqualified-id parsed. enum class UnqualifiedIdKind { … }; /// Represents a C++ unqualified-id that has been parsed. class UnqualifiedId { … }; /// A set of tokens that has been cached for later parsing. CachedTokens; /// One instance of this struct is used for each type in a /// declarator that is parsed. /// /// This is intended to be a small value object. struct DeclaratorChunk { … }; /// A parsed C++17 decomposition declarator of the form /// '[' identifier-list ']' class DecompositionDeclarator { … }; /// Described the kind of function definition (if any) provided for /// a function. enum class FunctionDefinitionKind { … }; enum class DeclaratorContext { … }; // Describes whether the current context is a context where an implicit // typename is allowed (C++2a [temp.res]p5]). enum class ImplicitTypenameContext { … }; /// Information about one declarator, including the parsed type /// information and the identifier. /// /// When the declarator is fully formed, this is turned into the appropriate /// Decl object. /// /// Declarators come in two types: normal declarators and abstract declarators. /// Abstract declarators are used when parsing types, and don't have an /// identifier. Normal declarators do have ID's. /// /// Instances of this class should be a transient object that lives on the /// stack, not objects that are allocated in large quantities on the heap. class Declarator { … }; /// This little struct is used to capture information about /// structure field declarators, which is basically just a bitfield size. struct FieldDeclarator { … }; /// Represents a C++11 virt-specifier-seq. class VirtSpecifiers { … }; enum class LambdaCaptureInitKind { … }; /// Represents a complete lambda introducer. struct LambdaIntroducer { … }; struct InventedTemplateParameterInfo { … }; } // end namespace clang #endif // LLVM_CLANG_SEMA_DECLSPEC_H