aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Lower/ConvertProcedureDesignator.cpp
diff options
context:
space:
mode:
authorjeanPerier <jperier@nvidia.com>2024-01-19 15:09:25 +0100
committerGitHub <noreply@github.com>2024-01-19 15:09:25 +0100
commiteaa8def929b17ea4c7a13a7bf860ac07bfd5bf14 (patch)
treebdc94a48a936c80d71c41a644fc94bf49c42b825 /flang/lib/Lower/ConvertProcedureDesignator.cpp
parent836dcdb84ab91aa2b69a6cec412d83c840a7196d (diff)
downloadllvm-eaa8def929b17ea4c7a13a7bf860ac07bfd5bf14.zip
llvm-eaa8def929b17ea4c7a13a7bf860ac07bfd5bf14.tar.gz
llvm-eaa8def929b17ea4c7a13a7bf860ac07bfd5bf14.tar.bz2
[flang] Expand parent component in procedure pointer component ref (#78593)
For simplicity, lowering relies on semantics expansion of parent components in designators. This was not done in `call x%p()` where `p` is a procedure component pointer of a parent component of `x`. Do it and turn lowering TODO into a new lowering TODO for `call bar(x%type_bound_procedure)` (passing a tybe bound procedure is allowed as an extension, but lowering does not handle this extension yet. This is a lowering issue, will do in different patch).
Diffstat (limited to 'flang/lib/Lower/ConvertProcedureDesignator.cpp')
-rw-r--r--flang/lib/Lower/ConvertProcedureDesignator.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/flang/lib/Lower/ConvertProcedureDesignator.cpp b/flang/lib/Lower/ConvertProcedureDesignator.cpp
index 0806f78..2446be3 100644
--- a/flang/lib/Lower/ConvertProcedureDesignator.cpp
+++ b/flang/lib/Lower/ConvertProcedureDesignator.cpp
@@ -113,10 +113,10 @@ static hlfir::EntityWithAttributes designateProcedurePointerComponent(
auto recordType =
hlfir::getFortranElementType(base.getType()).cast<fir::RecordType>();
mlir::Type fieldType = recordType.getType(fieldName);
- // FIXME: semantics is not expanding intermediate parent components in:
- // call x%p() where p is a component of a parent type of x type.
+ // Note: semantics turns x%p() into x%t%p() when the procedure pointer
+ // component is part of parent component t.
if (!fieldType)
- TODO(loc, "reference to procedure pointer component from parent type");
+ TODO(loc, "passing type bound procedure (extension)");
mlir::Type designatorType = fir::ReferenceType::get(fieldType);
mlir::Value compRef = builder.create<hlfir::DesignateOp>(
loc, designatorType, base, fieldName,