Skip to content

Commit 08d8c69

Browse files
committed
[CIR][NFC] Add stubs for missing visitors in ScalarExprEmitter
This adds stubs that issue NYI errors for any visitor that is present in the ClangIR incubator but missing in the upstream implementation. This will make it easier to find to correct locations to implement missing functionality.
1 parent 762a171 commit 08d8c69

File tree

1 file changed

+147
-1
lines changed

1 file changed

+147
-1
lines changed

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 147 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
159159
mlir::Value VisitCoawaitExpr(CoawaitExpr *s) {
160160
return cgf.emitCoawaitExpr(*s).getValue();
161161
}
162+
mlir::Value VisitCoyieldExpr(CoyieldExpr *e) {
163+
cgf.cgm.errorNYI(e->getSourceRange(), "coyield expr");
164+
return {};
165+
}
166+
mlir::Value VisitUnaryCoawait(const UnaryOperator *e) {
167+
cgf.cgm.errorNYI(e->getSourceRange(), "unary coawait expr");
168+
return {};
169+
}
162170

163171
mlir::Value emitLoadOfLValue(LValue lv, SourceLocation loc) {
164172
return cgf.emitLoadOfLValue(lv, loc).getValue();
@@ -198,6 +206,11 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
198206
cir::IntAttr::get(type, e->getValue()));
199207
}
200208

209+
mlir::Value VisitFixedPointLiteral(const FixedPointLiteral *e) {
210+
cgf.cgm.errorNYI(e->getSourceRange(), "fixed point literal");
211+
return {};
212+
}
213+
201214
mlir::Value VisitFloatingLiteral(const FloatingLiteral *e) {
202215
mlir::Type type = cgf.convertType(e->getType());
203216
assert(mlir::isa<cir::FPTypeInterface>(type) &&
@@ -229,6 +242,19 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
229242

230243
mlir::Value VisitOffsetOfExpr(OffsetOfExpr *e);
231244

245+
mlir::Value VisitSizeOfPackExpr(SizeOfPackExpr *e) {
246+
cgf.cgm.errorNYI(e->getSourceRange(), "size of pack expr");
247+
return {};
248+
}
249+
mlir::Value VisitPseudoObjectExpr(PseudoObjectExpr *e) {
250+
cgf.cgm.errorNYI(e->getSourceRange(), "pseudo object expr");
251+
return {};
252+
}
253+
mlir::Value VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *e) {
254+
cgf.cgm.errorNYI(e->getSourceRange(), "sycl unique stable name expr");
255+
return {};
256+
}
257+
232258
mlir::Value VisitOpaqueValueExpr(OpaqueValueExpr *e) {
233259
if (e->isGLValue())
234260
return emitLoadOfLValue(cgf.getOrCreateOpaqueLValueMapping(e),
@@ -238,6 +264,36 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
238264
return cgf.getOrCreateOpaqueRValueMapping(e).getValue();
239265
}
240266

267+
mlir::Value VisitObjCSelectorExpr(ObjCSelectorExpr *e) {
268+
cgf.cgm.errorNYI(e->getSourceRange(), "objc selector expr");
269+
return {};
270+
}
271+
mlir::Value VisitObjCProtocolExpr(ObjCProtocolExpr *e) {
272+
cgf.cgm.errorNYI(e->getSourceRange(), "objc protocol expr");
273+
return {};
274+
}
275+
mlir::Value VisitObjCIVarRefExpr(ObjCIvarRefExpr *e) {
276+
cgf.cgm.errorNYI(e->getSourceRange(), "objc ivar ref expr");
277+
return {};
278+
}
279+
mlir::Value VisitObjCMessageExpr(ObjCMessageExpr *e) {
280+
cgf.cgm.errorNYI(e->getSourceRange(), "objc message expr");
281+
return {};
282+
}
283+
mlir::Value VisitObjCIsaExpr(ObjCIsaExpr *e) {
284+
cgf.cgm.errorNYI(e->getSourceRange(), "objc isa expr");
285+
return {};
286+
}
287+
mlir::Value VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *e) {
288+
cgf.cgm.errorNYI(e->getSourceRange(), "objc availability check expr");
289+
return {};
290+
}
291+
292+
mlir::Value VisitMatrixSubscriptExpr(MatrixSubscriptExpr *e) {
293+
cgf.cgm.errorNYI(e->getSourceRange(), "matrix subscript expr");
294+
return {};
295+
}
296+
241297
mlir::Value VisitCastExpr(CastExpr *e);
242298
mlir::Value VisitCallExpr(const CallExpr *e);
243299

@@ -319,6 +375,16 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
319375

320376
mlir::Value VisitInitListExpr(InitListExpr *e);
321377

378+
mlir::Value VisitArrayInitIndexExpr(ArrayInitIndexExpr *e) {
379+
cgf.cgm.errorNYI(e->getSourceRange(), "array init index expr");
380+
return {};
381+
}
382+
383+
mlir::Value VisitImplicitValueInitExpr(const ImplicitValueInitExpr *e) {
384+
cgf.cgm.errorNYI(e->getSourceRange(), "implicit value init expr");
385+
return {};
386+
}
387+
322388
mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) {
323389
return VisitCastExpr(e);
324390
}
@@ -726,6 +792,15 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
726792
return Visit(e->getSubExpr());
727793
}
728794

795+
// C++
796+
mlir::Value VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *e) {
797+
cgf.cgm.errorNYI(e->getSourceRange(), "materialize temporary expr");
798+
return {};
799+
}
800+
mlir::Value VisitSourceLocExpr(SourceLocExpr *e) {
801+
cgf.cgm.errorNYI(e->getSourceRange(), "source loc expr");
802+
return {};
803+
}
729804
mlir::Value VisitCXXDefaultArgExpr(CXXDefaultArgExpr *dae) {
730805
CIRGenFunction::CXXDefaultArgExprScope scope(cgf, dae);
731806
return Visit(dae->getExpr());
@@ -745,11 +820,39 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
745820
cgf.emitCXXDeleteExpr(e);
746821
return {};
747822
}
748-
823+
mlir::Value VisitTypeTraitExpr(const TypeTraitExpr *e) {
824+
cgf.cgm.errorNYI(e->getSourceRange(), "type trait expr");
825+
return {};
826+
}
827+
mlir::Value
828+
VisitConceptSpecializationExpr(const ConceptSpecializationExpr *e) {
829+
cgf.cgm.errorNYI(e->getSourceRange(), "concept specialization expr");
830+
return {};
831+
}
832+
mlir::Value VisitRequiresExpr(const RequiresExpr *e) {
833+
cgf.cgm.errorNYI(e->getSourceRange(), "requires expr");
834+
return {};
835+
}
836+
mlir::Value VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *e) {
837+
cgf.cgm.errorNYI(e->getSourceRange(), "array type trait expr");
838+
return {};
839+
}
840+
mlir::Value VisitExpressionTraitExpr(const ExpressionTraitExpr *e) {
841+
cgf.cgm.errorNYI(e->getSourceRange(), "expression trait expr");
842+
return {};
843+
}
844+
mlir::Value VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *e) {
845+
cgf.cgm.errorNYI(e->getSourceRange(), "cxx pseudo destructor expr");
846+
return {};
847+
}
749848
mlir::Value VisitCXXThrowExpr(const CXXThrowExpr *e) {
750849
cgf.emitCXXThrowExpr(e);
751850
return {};
752851
}
852+
mlir::Value VisitCXXNoexceptExpr(CXXNoexceptExpr *e) {
853+
cgf.cgm.errorNYI(e->getSourceRange(), "cxx noexcept expr");
854+
return {};
855+
}
753856

754857
/// Emit a conversion from the specified type to the specified destination
755858
/// type, both of which are CIR scalar types.
@@ -1213,6 +1316,49 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
12131316
return maybePromoteBoolResult(resOp.getResult(), resTy);
12141317
}
12151318

1319+
mlir::Value VisitBinPtrMemD(const BinaryOperator *e) {
1320+
cgf.cgm.errorNYI(e->getSourceRange(), "ptr mem d expr");
1321+
return {};
1322+
}
1323+
1324+
mlir::Value VisitBinPtrMemI(const BinaryOperator *e) {
1325+
cgf.cgm.errorNYI(e->getSourceRange(), "ptr mem i expr");
1326+
return {};
1327+
}
1328+
1329+
// Other Operators.
1330+
mlir::Value VisitBlockExpr(const BlockExpr *e) {
1331+
cgf.cgm.errorNYI(e->getSourceRange(), "block expr");
1332+
return {};
1333+
}
1334+
1335+
mlir::Value VisitChooseExpr(ChooseExpr *e) {
1336+
cgf.cgm.errorNYI(e->getSourceRange(), "choose expr");
1337+
return {};
1338+
}
1339+
1340+
mlir::Value VisitObjCStringLiteral(const ObjCStringLiteral *e) {
1341+
cgf.cgm.errorNYI(e->getSourceRange(), "objc string literal");
1342+
return {};
1343+
}
1344+
mlir::Value VisitObjCBoxedExpr(ObjCBoxedExpr *e) {
1345+
cgf.cgm.errorNYI(e->getSourceRange(), "objc boxed expr");
1346+
return {};
1347+
}
1348+
mlir::Value VisitObjCArrayLiteral(ObjCArrayLiteral *e) {
1349+
cgf.cgm.errorNYI(e->getSourceRange(), "objc array literal");
1350+
return {};
1351+
}
1352+
mlir::Value VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *e) {
1353+
cgf.cgm.errorNYI(e->getSourceRange(), "objc dictionary literal");
1354+
return {};
1355+
}
1356+
1357+
mlir::Value VisitAsTypeExpr(AsTypeExpr *e) {
1358+
cgf.cgm.errorNYI(e->getSourceRange(), "as type expr");
1359+
return {};
1360+
}
1361+
12161362
mlir::Value VisitAtomicExpr(AtomicExpr *e) {
12171363
return cgf.emitAtomicExpr(e).getValue();
12181364
}

0 commit comments

Comments
 (0)