[flang-commits] [flang] [flang] fix C_PTR function result lowering (PR #100082)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Jul 23 03:42:35 PDT 2024


================
@@ -1541,21 +1541,45 @@ mlir::Value fir::factory::genMaxWithZero(fir::FirOpBuilder &builder,
                                                zero);
 }
 
+static std::pair<mlir::Value, mlir::Type>
+genCPtrOrCFunptrFieldIndex(fir::FirOpBuilder &builder, mlir::Location loc,
+                           mlir::Type cptrTy) {
+  assert(mlir::isa<fir::RecordType>(cptrTy));
+  auto recTy = mlir::dyn_cast<fir::RecordType>(cptrTy);
----------------
tblah wrote:

nit: assert + dyn_cast can just be `mlir::cast`. See https://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates

https://github.com/llvm/llvm-project/pull/100082


More information about the flang-commits mailing list