Skip to content

Commit f44b945

Browse files
DetermineCopyInOut() is now called from ProcedureRef constructor
1 parent 28bc5bd commit f44b945

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

flang/include/flang/Evaluate/call.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,11 @@ class ProcedureRef {
248248
ProcedureRef(ProcedureDesignator &&p, ActualArguments &&a,
249249
bool hasAlternateReturns = false)
250250
: proc_{std::move(p)}, arguments_{std::move(a)},
251-
hasAlternateReturns_{hasAlternateReturns} {}
251+
hasAlternateReturns_{hasAlternateReturns} {
252+
// Gathers necessary information to determine the need for copy-in and
253+
// copy-out
254+
DetermineCopyInOut();
255+
}
252256
~ProcedureRef();
253257
static void Deleter(ProcedureRef *);
254258

@@ -285,9 +289,9 @@ class ProcedureRef {
285289
bool operator==(const ProcedureRef &) const;
286290
llvm::raw_ostream &AsFortran(llvm::raw_ostream &) const;
287291

292+
protected:
288293
void DetermineCopyInOut();
289294

290-
protected:
291295
ProcedureDesignator proc_;
292296
ActualArguments arguments_;
293297
Chevrons chevrons_;

flang/include/flang/Lower/CallInterface.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,6 @@ class CallerInterface : public CallInterface<CallerInterface> {
284284
CallerInterface(const Fortran::evaluate::ProcedureRef &p,
285285
Fortran::lower::AbstractConverter &c)
286286
: CallInterface{c}, procRef{p} {
287-
// Ensure that procRef gathers necessary information to determine the
288-
// need for copy-in and copy-out
289-
const_cast<Fortran::evaluate::ProcedureRef &>(procRef).DetermineCopyInOut();
290287
declare();
291288
mapPassedEntities();
292289
actualInputs.resize(getNumFIRArguments());

flang/lib/Evaluate/call.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void ProcedureRef::DetermineCopyInOut() {
255255
// Get folding context of the call site owner
256256
FoldingContext &fc{proc_.GetSymbol()->owner().context().foldingContext()};
257257
auto procInfo{characteristics::Procedure::Characterize(
258-
proc(), fc, /*emitError=*/false)};
258+
proc_, fc, /*emitError=*/true)};
259259
if (!procInfo) {
260260
return;
261261
}

0 commit comments

Comments
 (0)