Path: blob/main/contrib/llvm-project/clang/lib/AST/ExprConstShared.h
35259 views
//===--- ExprConstShared.h - Shared consetxpr functionality ----*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// Shared functionality between the new constant expression9// interpreter (AST/Interp/) and the current one (ExprConstant.cpp).10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_CLANG_LIB_AST_EXPRCONSTSHARED_H14#define LLVM_CLANG_LIB_AST_EXPRCONSTSHARED_H1516namespace llvm {17class APFloat;18}19namespace clang {20class QualType;21class LangOptions;22} // namespace clang23using namespace clang;24/// Values returned by __builtin_classify_type, chosen to match the values25/// produced by GCC's builtin.26enum class GCCTypeClass {27None = -1,28Void = 0,29Integer = 1,30// GCC reserves 2 for character types, but instead classifies them as31// integers.32Enum = 3,33Bool = 4,34Pointer = 5,35// GCC reserves 6 for references, but appears to never use it (because36// expressions never have reference type, presumably).37PointerToDataMember = 7,38RealFloat = 8,39Complex = 9,40// GCC reserves 10 for functions, but does not use it since GCC version 6 due41// to decay to pointer. (Prior to version 6 it was only used in C++ mode).42// GCC claims to reserve 11 for pointers to member functions, but *actually*43// uses 12 for that purpose, same as for a class or struct. Maybe it44// internally implements a pointer to member as a struct? Who knows.45PointerToMemberFunction = 12, // Not a bug, see above.46ClassOrStruct = 12,47Union = 13,48// GCC reserves 14 for arrays, but does not use it since GCC version 6 due to49// decay to pointer. (Prior to version 6 it was only used in C++ mode).50// GCC reserves 15 for strings, but actually uses 5 (pointer) for string51// literals.52// Lang = 16,53// OpaqueType = 17,54BitInt = 18,55Vector = 1956};5758GCCTypeClass EvaluateBuiltinClassifyType(QualType T,59const LangOptions &LangOpts);6061void HandleComplexComplexMul(llvm::APFloat A, llvm::APFloat B, llvm::APFloat C,62llvm::APFloat D, llvm::APFloat &ResR,63llvm::APFloat &ResI);64void HandleComplexComplexDiv(llvm::APFloat A, llvm::APFloat B, llvm::APFloat C,65llvm::APFloat D, llvm::APFloat &ResR,66llvm::APFloat &ResI);6768#endif697071