clang 20.0.0git
CIRGenTypes.h
Go to the documentation of this file.
1//===--- CIRGenTypes.h - Type translation for CIR CodeGen -------*- 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// This is the code that handles AST -> CIR type lowering.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENTYPES_H
14#define LLVM_CLANG_LIB_CODEGEN_CODEGENTYPES_H
15
17
18#include "llvm/ADT/SmallPtrSet.h"
19
20namespace clang {
21class ASTContext;
22class FunctionType;
23class QualType;
24class Type;
25} // namespace clang
26
27namespace mlir {
28class Type;
29}
30
31namespace clang::CIRGen {
32
33class CIRGenBuilderTy;
34class CIRGenModule;
35
36/// This class organizes the cross-module state that is used while lowering
37/// AST types to CIR types.
39 CIRGenModule &cgm;
40 clang::ASTContext &astContext;
41 CIRGenBuilderTy &builder;
42
43 /// Heper for ConvertType.
44 mlir::Type ConvertFunctionTypeInternal(clang::QualType ft);
45
46public:
49
50 /// Utility to check whether a function type can be converted to a CIR type
51 /// (i.e. doesn't depend on an incomplete tag type).
54
55 /// This map of clang::Type to mlir::Type (which includes CIR type) is a
56 /// cache of types that have already been processed.
57 using TypeCacheTy = llvm::DenseMap<const clang::Type *, mlir::Type>;
59
60 mlir::MLIRContext &getMLIRContext() const;
61
62 /// Convert a Clang type into a mlir::Type.
64};
65
66} // namespace clang::CIRGen
67
68#endif
MatchType Type
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:188
This class organizes the cross-function state that is used while generating CIR code.
Definition: CIRGenModule.h:39
This class organizes the cross-module state that is used while lowering AST types to CIR types.
Definition: CIRGenTypes.h:38
bool isFuncTypeConvertible(const clang::FunctionType *ft)
Utility to check whether a function type can be converted to a CIR type (i.e.
Definition: CIRGenTypes.cpp:47
mlir::MLIRContext & getMLIRContext() const
Definition: CIRGenTypes.cpp:20
bool isFuncParamTypeConvertible(clang::QualType type)
Return true if the specified type in a function parameter or result position can be converted to a CI...
Definition: CIRGenTypes.cpp:28
mlir::Type convertType(clang::QualType type)
Convert a Clang type into a mlir::Type.
Definition: CIRGenTypes.cpp:88
llvm::DenseMap< const clang::Type *, mlir::Type > TypeCacheTy
This map of clang::Type to mlir::Type (which includes CIR type) is a cache of types that have already...
Definition: CIRGenTypes.h:57
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:4321
A (possibly-)qualified type.
Definition: Type.h:929
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
The JSON file list parser is used to communicate input to InstallAPI.