//===--- SemaDeclSpec.h - Declaration Specifier Semantic Analys -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines interfaces used for Declaration Specifiers and Declarators.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_PARSE_DECLSPEC_H
#define LLVM_CLANG_PARSE_DECLSPEC_H
#include "clang/Parse/AttributeList.h"
#include "clang/Lex/Token.h"
#include "clang/Basic/OperatorKinds.h"
#include "llvm/ADT/SmallVector.h"
namespace clang {
class LangOptions;
class Diagnostic;
class IdentifierInfo;
class Preprocessor;
class Declarator;
struct TemplateIdAnnotation;
/// DeclSpec - This class captures information about "declaration specifiers",
/// which encompasses storage-class-specifiers, type-specifiers,
/// type-qualifiers, and function-specifiers.
class DeclSpec {
public:
// storage-class-specifier
enum SCS {
SCS_unspecified,
SCS_typedef,
SCS_extern,
SCS_static,
SCS_auto,
SCS_register,
SCS_private_extern,
SCS_mutable
};
// type-specifier
enum TSW {
TSW_unspecified,
TSW_short,
TSW_long,
TSW_longlong
};
enum TSC {
TSC_unspecified,
TSC_imaginary,
TSC_complex
};
enum TSS {
TSS_unspecified,
TSS_signed,
TSS_unsigned
};
enum TST {
TST_unspecified,
TST_void,
TST_char,
TST_wchar, // C++ wchar_t
TST_char16, // C++0x char16_t
TST_char32, // C++0x char32_t
TST_int,
TST_float,
TST_double,
TST_bool, // _Bool
TST_decimal32, // _Decimal32
TST_decimal64, // _Decimal64
TST_decimal128, // _Decimal128
TST_enum,
TST_union,
TST_struct,
TST_class, // C++ class type
TST_typename, // Typedef, C++ class-name or enum name, etc.
TST_typeofType,
TST_typeofExpr,
TST_decltype, // C++0x decltype
TST_auto, // C++0x auto
TST_error // erroneous type
};
// type-qualifiers
enum TQ { // NOTE: These flags must be kept in sync with Qualifiers::TQ.
TQ_unspecified = 0,
TQ_const = 1,
TQ_restrict = 2,
TQ_volatile = 4
};
/// ParsedSpecifiers - Flags to query which specifiers were applied. This is
/// returned by getParsedSpecifiers.
enum ParsedSpecifiers {
PQ_None = 0,
PQ_StorageClassSpecifier = 1,
PQ_TypeSpecifier = 2,
PQ_TypeQualifier = 4,
PQ_FunctionSpecifier = 8
};
private:
// storage-class-specifier
/*SCS*/unsigned StorageClassSpec : 3;
bool SCS_thread_specified : 1;
// type-specifier
/*TSW*/unsigned TypeSpecWidth : 2;
/*TSC*/unsigned TypeSpecComplex : 2;
/*TSS*/unsigned TypeSpecSign : 2;
/*TST*/unsigned TypeSpecType : 5;
bool TypeSpecOwned : 1;
// type-qualifiers
unsigned TypeQualifiers : 3; // Bitwise OR of TQ.
// function-specifier
bool FS_inline_specified : 1;
bool FS_virtual_specified : 1;
bool FS_explicit_specified : 1;
// friend-specifier
bool Friend_specified