clang 20.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 llvm {
18class APFloat;
19}
20namespace clang {
21class QualType;
22class LangOptions;
23} // namespace clang
24using namespace clang;
25/// Values returned by __builtin_classify_type, chosen to match the values
26/// produced by GCC's builtin.
27enum class GCCTypeClass {
28 None = -1,
29 Void = 0,
30 Integer = 1,
31 // GCC reserves 2 for character types, but instead classifies them as
32 // integers.
33 Enum = 3,
34 Bool = 4,
35 Pointer = 5,
36 // GCC reserves 6 for references, but appears to never use it (because
37 // expressions never have reference type, presumably).
39 RealFloat = 8,
40 Complex = 9,
41 // GCC reserves 10 for functions, but does not use it since GCC version 6 due
42 // to decay to pointer. (Prior to version 6 it was only used in C++ mode).
43 // GCC claims to reserve 11 for pointers to member functions, but *actually*
44 // uses 12 for that purpose, same as for a class or struct. Maybe it
45 // internally implements a pointer to member as a struct? Who knows.
46 PointerToMemberFunction = 12, // Not a bug, see above.
47 ClassOrStruct = 12,
48 Union = 13,
49 // GCC reserves 14 for arrays, but does not use it since GCC version 6 due to
50 // decay to pointer. (Prior to version 6 it was only used in C++ mode).
51 // GCC reserves 15 for strings, but actually uses 5 (pointer) for string
52 // literals.
53 // Lang = 16,
54 // OpaqueType = 17,
55 BitInt = 18,
56 Vector = 19
57};
58
60 const LangOptions &LangOpts);
61
62void HandleComplexComplexMul(llvm::APFloat A, llvm::APFloat B, llvm::APFloat C,
63 llvm::APFloat D, llvm::APFloat &ResR,
64 llvm::APFloat &ResI);
65void HandleComplexComplexDiv(llvm::APFloat A, llvm::APFloat B, llvm::APFloat C,
66 llvm::APFloat D, llvm::APFloat &ResR,
67 llvm::APFloat &ResI);
68
69#endif
const Decl * D
GCCTypeClass EvaluateBuiltinClassifyType(QualType T, const LangOptions &LangOpts)
EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way as GCC.
void HandleComplexComplexMul(llvm::APFloat A, llvm::APFloat B, llvm::APFloat C, llvm::APFloat D, llvm::APFloat &ResR, llvm::APFloat &ResI)
GCCTypeClass
Values returned by __builtin_classify_type, chosen to match the values produced by GCC's builtin.
@ PointerToMemberFunction
void HandleComplexComplexDiv(llvm::APFloat A, llvm::APFloat B, llvm::APFloat C, llvm::APFloat D, llvm::APFloat &ResR, llvm::APFloat &ResI)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:461
A (possibly-)qualified type.
Definition: Type.h:941
llvm::APFloat APFloat
Definition: Floating.h:23
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30