[flang-commits] [flang] [flang][openacc] use location of end directive for exit operations (PR #140763)

Andre Kuhlenschmidt via flang-commits flang-commits at lists.llvm.org
Tue May 20 11:02:20 PDT 2025


================
@@ -810,23 +810,25 @@ static void genDeclareDataOperandOperationsWithModifier(
 }
 
 template <typename EntryOp, typename ExitOp>
-static void genDataExitOperations(fir::FirOpBuilder &builder,
-                                  llvm::SmallVector<mlir::Value> operands,
-                                  bool structured) {
+static void
+genDataExitOperations(fir::FirOpBuilder &builder,
+                      llvm::SmallVector<mlir::Value> operands, bool structured,
+                      std::optional<mlir::Location> exitLoc = std::nullopt) {
   for (mlir::Value operand : operands) {
     auto entryOp = mlir::dyn_cast_or_null<EntryOp>(operand.getDefiningOp());
     assert(entryOp && "data entry op expected");
+    auto opLoc = exitLoc ? *exitLoc : entryOp.getLoc();
----------------
akuhlens wrote:

Just so that I have a better understanding of when you want a type annotation and when you don't , could you say why you want `Location` here?

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


More information about the flang-commits mailing list