Skip to content

Commit 0832ab8

Browse files
committed
[CIR][NFC] Mark CXXTypeidExpr lvalue emission as NYI
More skeleton: this change adds a specific NYI marker for C++ typeid expressions when used as lvalues, replacing the generic "not implemented" assertion.
1 parent 518da5a commit 0832ab8

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ struct MissingFeatures {
438438
// do not yet support this yet.
439439
static bool inallocaArgs() { return false; }
440440

441+
// C++ typeid expression support (returns type_info object reference)
442+
// Requires RTTI support including vtable lookups for polymorphic types.
443+
static bool cxxTypeid() { return false; }
444+
441445
// Parameters may have additional attributes (e.g. [[noescape]]) that affect
442446
// the compiler. This is not yet supported in CIR.
443447
static bool extParamInfo() { return false; }

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,6 +2101,11 @@ LValue CIRGenFunction::emitCastLValue(const CastExpr *E) {
21012101
llvm_unreachable("Unhandled lvalue cast kind?");
21022102
}
21032103

2104+
LValue CIRGenFunction::emitCXXTypeidLValue(const CXXTypeidExpr *E) {
2105+
assert(!cir::MissingFeatures::cxxTypeid() && "NYI");
2106+
llvm_unreachable("NYI");
2107+
}
2108+
21042109
// TODO(cir): candidate for common helper between LLVM and CIR codegen.
21052110
static DeclRefExpr *tryToConvertMemberExprToDeclRefExpr(CIRGenFunction &CGF,
21062111
const MemberExpr *ME) {
@@ -2726,6 +2731,9 @@ LValue CIRGenFunction::emitLValue(const Expr *E) {
27262731
case Expr::MaterializeTemporaryExprClass:
27272732
return emitMaterializeTemporaryExpr(cast<MaterializeTemporaryExpr>(E));
27282733

2734+
case Expr::CXXTypeidExprClass:
2735+
return emitCXXTypeidLValue(cast<CXXTypeidExpr>(E));
2736+
27292737
case Expr::ObjCPropertyRefExprClass:
27302738
llvm_unreachable("cannot emit a property reference directly");
27312739
case Expr::StmtExprClass:

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,7 @@ class CIRGenFunction : public CIRGenTypeCache {
19141914
cir::CaseOpKind kind,
19151915
bool buildingTopLevelCase);
19161916
LValue emitCastLValue(const CastExpr *E);
1917+
LValue emitCXXTypeidLValue(const CXXTypeidExpr *E);
19171918

19181919
mlir::LogicalResult emitCaseStmt(const clang::CaseStmt &S,
19191920
mlir::Type condType,

0 commit comments

Comments
 (0)