Skip to content

Commit 3198e90

Browse files
More args handing in DetermineCopyInOut()
1 parent 9c1755b commit 3198e90

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

flang/lib/Evaluate/call.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,15 @@ void ProcedureRef::DetermineCopyInOut() {
276276
if (!procInfo) {
277277
return;
278278
}
279-
// TODO: at this point have dummy arguments as procInfo->dummyArguments
280-
// and have actual arguments via arguments_
281-
282-
// TODO: implicitly declared procedure may not have any information about
283-
// its dummy args. Handle this case.
284-
279+
if (!procInfo->HasExplicitInterface()) {
280+
for (auto &actual : arguments_) {
281+
if (!actual) {
282+
continue;
283+
}
284+
DetermineCopyInOutArgument(*procInfo, *actual);
285+
}
286+
return;
287+
}
285288
// Don't change anything about actual or dummy arguments, except for
286289
// computing copy-in/copy-out information. If detect something wrong with
287290
// the arguments, stop processing and let semantic analysis generate the
@@ -308,7 +311,13 @@ void ProcedureRef::DetermineCopyInOut() {
308311
}
309312
else {
310313
processedKeywords.insert(actualName);
311-
314+
if (auto it = std::find_if(procInfo->dummyArguments.begin(),
315+
procInfo->dummyArguments.end(),
316+
[&](const characteristics::DummyArgument &dummy) {
317+
return dummy.name == actualName;
318+
}); it != procInfo->dummyArguments.end()) {
319+
DetermineCopyInOutArgument(*procInfo, *actual, *it);
320+
}
312321
}
313322
}
314323
else if (seenKeyword) {
@@ -318,6 +327,8 @@ void ProcedureRef::DetermineCopyInOut() {
318327
}
319328
else {
320329
// Positional argument processing
330+
DetermineCopyInOutArgument(*procInfo, *actual,
331+
procInfo->dummyArguments[index]);
321332
}
322333

323334
++index;

0 commit comments

Comments
 (0)