Skip to content

Commit

Permalink
[CIR][Rebase] Add new enum type handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lanza committed Apr 17, 2024
1 parent b2c5ff3 commit d0eed34
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "clang/AST/ExprCXX.h"
#include "clang/AST/GlobalDecl.h"
#include "clang/AST/OperationKinds.h"
#include "clang/Basic/Builtins.h"
#include "clang/CIR/Dialect/IR/CIRDialect.h"
#include "clang/CIR/Dialect/IR/CIROpsEnums.h"
Expand Down Expand Up @@ -1601,6 +1602,7 @@ LValue CIRGenFunction::buildStringLiteralLValue(const StringLiteral *E) {
/// result, including noop aggregate casts, and cast from scalar to union.
LValue CIRGenFunction::buildCastLValue(const CastExpr *E) {
switch (E->getCastKind()) {
case CK_HLSLArrayRValue:
case CK_HLSLVectorTruncation:
case CK_ToVoid:
case CK_BitCast:
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ bool AggExprEmitter::TypeRequiresGCollection(QualType T) {
/// TODO(cir): this can be shared with LLVM codegen.
static bool castPreservesZero(const CastExpr *CE) {
switch (CE->getCastKind()) {
case CK_HLSLArrayRValue:
llvm_unreachable("NYI");
case CK_HLSLVectorTruncation:
llvm_unreachable("NYI");
// No-ops.
Expand Down
1 change: 1 addition & 0 deletions clang/lib/CIR/CodeGen/CIRGenExprConst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ class ConstExprEmitter
Expr *subExpr = E->getSubExpr();

switch (E->getCastKind()) {
case CK_HLSLArrayRValue:
case CK_HLSLVectorTruncation:
case CK_ToUnion:
llvm_unreachable("not implemented");
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ TypeEvaluationKind CIRGenFunction::getEvaluationKind(QualType type) {
type = type.getCanonicalType();
while (true) {
switch (type->getTypeClass()) {
case Type::ArrayParameter:
llvm_unreachable("NYI");
#define TYPE(name, parent)
#define ABSTRACT_TYPE(name, parent)
#define NON_CANONICAL_TYPE(name, parent) case Type::name:
Expand Down Expand Up @@ -1554,6 +1556,8 @@ void CIRGenFunction::buildVariablyModifiedType(QualType type) {

const Type *ty = type.getTypePtr();
switch (ty->getTypeClass()) {
case Type::ArrayParameter:
llvm_unreachable("NYI");
case clang::Type::CountAttributed:
case clang::Type::PackIndexing:
llvm_unreachable("NYI");
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,8 @@ void CIRGenItaniumRTTIBuilder::BuildVTablePointer(mlir::Location loc,
const char *VTableName = nullptr;

switch (Ty->getTypeClass()) {
case Type::ArrayParameter:
llvm_unreachable("NYI");
#define TYPE(Class, Base)
#define ABSTRACT_TYPE(Class, Base)
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
Expand Down Expand Up @@ -1838,6 +1840,8 @@ mlir::Attribute CIRGenItaniumRTTIBuilder::BuildTypeInfo(
Fields.push_back(TypeNameField);

switch (Ty->getTypeClass()) {
case Type::ArrayParameter:
llvm_unreachable("NYI");
#define TYPE(Class, Base)
#define ABSTRACT_TYPE(Class, Base)
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ mlir::Type CIRGenTypes::ConvertType(QualType T) {
// If we don't have it in the cache, convert it now.
mlir::Type ResultType = nullptr;
switch (Ty->getTypeClass()) {
case Type::ArrayParameter:
llvm_unreachable("NYI");
case Type::Record: // Handled above.
#define TYPE(Class, Base)
#define ABSTRACT_TYPE(Class, Base)
Expand Down

0 comments on commit d0eed34

Please sign in to comment.