clang 19.0.0git
ExprConstShared.h
Go to the documentation of this file.
1//===--- ExprConstShared.h - Shared consetxpr functionality ----*- 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// Shared functionality between the new constant expression
10// interpreter (AST/Interp/) and the current one (ExprConstant.cpp).
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_LIB_AST_EXPRCONSTSHARED_H
15#define LLVM_CLANG_LIB_AST_EXPRCONSTSHARED_H
16
17namespace clang {
18class QualType;
19class LangOptions;
20} // namespace clang
21using namespace clang;
22/// Values returned by __builtin_classify_type, chosen to match the values
23/// produced by GCC's builtin.
24enum class GCCTypeClass {
25 None = -1,
26 Void = 0,
27 Integer = 1,
28 // GCC reserves 2 for character types, but instead classifies them as
29 // integers.
30 Enum = 3,
31 Bool = 4,
32 Pointer = 5,
33 // GCC reserves 6 for references, but appears to never use it (because
34 // expressions never have reference type, presumably).
36 RealFloat = 8,
37 Complex = 9,
38 // GCC reserves 10 for functions, but does not use it since GCC version 6 due
39 // to decay to pointer. (Prior to version 6 it was only used in C++ mode).
40 // GCC claims to reserve 11 for pointers to member functions, but *actually*
41 // uses 12 for that purpose, same as for a class or struct. Maybe it
42 // internally implements a pointer to member as a struct? Who knows.
43 PointerToMemberFunction = 12, // Not a bug, see above.
44 ClassOrStruct = 12,
45 Union = 13,
46 // GCC reserves 14 for arrays, but does not use it since GCC version 6 due to
47 // decay to pointer. (Prior to version 6 it was only used in C++ mode).
48 // GCC reserves 15 for strings, but actually uses 5 (pointer) for string
49 // literals.
50 // Lang = 16,
51 // OpaqueType = 17,
52 BitInt = 18,
53 Vector = 19
54};
55
57 const LangOptions &LangOpts);
58
59#endif
GCCTypeClass EvaluateBuiltinClassifyType(QualType T, const LangOptions &LangOpts)
EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way as GCC.
GCCTypeClass
Values returned by __builtin_classify_type, chosen to match the values produced by GCC's builtin.
@ PointerToMemberFunction
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:418
A (possibly-)qualified type.
Definition: Type.h:737
The JSON file list parser is used to communicate input to InstallAPI.