Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR] Cleanup: convert from Clang type to CIR type #1271

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

dkolsen-pgi
Copy link
Collaborator

Class CIRGenFunction contained three identical functions that converted from a Clang AST type (clang::QualType) to a ClangIR type (mlir::Type): convertType, ConvertType, and getCIRType. This embarrassment of duplication needed to be fixed, along with cleaning up other functions that convert from Clang types to ClangIR types.

The three functions CIRGenFunction::ConvertType, CIRGenFunction::convertType, and CIRGenFunction::getCIRType were combined into a single function CIRGenFunction::convertType. Other functions were renamed as follows:

  • CIRGenTypes::ConvertType to CIRGenTypes::convertType
  • CIRGenTypes::ConvertFunctionTypeInternal to CIRGenTypes::convertFunctionTypeInternal
  • CIRGenModule::getCIRType to CIRGenModule::convertType
  • ConstExprEmitter::ConvertType to ConstExprEmitter::convertType
  • ScalarExprEmitter::ConvertType to ScalarExprEmitter::convertType

Many cases of getTypes().convertType(t) and getTypes().convertTypeForMem(t) were changed to just convertType(t) and convertTypeForMem(t), respectively, because the forwarding functions in CIRGenModule and CIRGenFunction make the explicit call to getTypes() unnecessary.

Class `CIRGenFunction` contained three identical functions that
converted from a Clang AST type (`clang::QualType`) to a ClangIR type
(`mlir::Type`): `convertType`, `ConvertType`, and `getCIRType`.  This
embarrassment of duplication needed to be fixed, along with cleaning up
other functions that convert from Clang types to ClangIR types.

The three functions `CIRGenFunction::ConvertType`,
`CIRGenFunction::convertType`, and `CIRGenFunction::getCIRType` were
combined into a single function `CIRGenFunction::convertType`.  Other
functions were renamed as follows:
	`CIRGenTypes::ConvertType` to `CIRGenTypes::convertType`
	`CIRGenTypes::ConvertFunctionTypeInternal` to `CIRGenTypes::convertFunctionTypeInternal`
	`CIRGenModule::getCIRType` to `CIRGenModule::convertType`
	`ConstExprEmitter::ConvertType` to `ConstExprEmitter::convertType`
	`ScalarExprEmitter::ConvertType` to `ScalarExprEmitter::convertType`

Many cases of `getTypes().convertType(t)` and
`getTypes().convertTypeForMem(t)` were changed to just `convertType(t)`
and `convertTypeForMem(t)`, respectively, because the forwarding
functions in `CIRGenModule` and `CIRGenFunction` make the explicit call
to `getTypes()` unnecessary.
@dkolsen-pgi dkolsen-pgi requested review from smeenai and bcardosolopes and removed request for bcardosolopes and lanza January 8, 2025 23:00
@bcardosolopes
Copy link
Member

Awesome, thanks for the cleanup

@bcardosolopes bcardosolopes merged commit 6df2cab into llvm:main Jan 9, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants