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 
17 namespace clang {
18 class QualType;
19 class LangOptions;
20 } // namespace clang
21 using namespace clang;
22 /// Values returned by __builtin_classify_type, chosen to match the values
23 /// produced by GCC's builtin.
24 enum 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).
35   PointerToDataMember = 7,
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 
56 GCCTypeClass EvaluateBuiltinClassifyType(QualType T,
57                                          const LangOptions &LangOpts);
58 
59 #endif
60