//===- llvm/Type.h - Classes for handling data types ------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file contains the declaration of the Type class. For more "Type" // stuff, look in DerivedTypes.h. // //===----------------------------------------------------------------------===// #ifndef LLVM_IR_TYPE_H #define LLVM_IR_TYPE_H #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/TypeSize.h" #include <cassert> #include <cstdint> #include <iterator> namespace llvm { class IntegerType; struct fltSemantics; class LLVMContext; class PointerType; class raw_ostream; class StringRef; template <typename PtrType> class SmallPtrSetImpl; /// The instances of the Type class are immutable: once they are created, /// they are never changed. Also note that only one instance of a particular /// type is ever created. Thus seeing if two types are equal is a matter of /// doing a trivial pointer comparison. To enforce that no two equal instances /// are created, Type instances can only be created via static factory methods /// in class Type and in derived classes. Once allocated, Types are never /// free'd. /// class Type { … }; // Printing of types. inline raw_ostream &operator<<(raw_ostream &OS, const Type &T) { … } // allow isa<PointerType>(x) to work without DerivedTypes.h included. template <> struct isa_impl<PointerType, Type> { … }; // Create wrappers for C Binding types (see CBindingWrapping.h). DEFINE_ISA_CONVERSION_FUNCTIONS(…) /* Specialized opaque type conversions. */ inline Type **unwrap(LLVMTypeRef* Tys) { … } inline LLVMTypeRef *wrap(Type **Tys) { … } } // end namespace llvm #endif // LLVM_IR_TYPE_H