forked from OSchip/llvm-project
[flang] Save CallStmt::typedCall (flang-compiler/f18#879)
When `ExpressionAnalyzer::AnalyzeCall` processed a subroutine it was always returning std::nullopt. Change it to return a `ProcedureRef` wrapped in an `Expr` so that it can be saved in `CallStmt::typedCall`. Original-commit: flang-compiler/f18@2cc226f66e Reviewed-on: https://github.com/flang-compiler/f18/pull/879
This commit is contained in:
parent
b200b244f6
commit
2e9633125e
|
@ -1822,9 +1822,9 @@ MaybeExpr ExpressionAnalyzer::Analyze(
|
|||
}
|
||||
|
||||
void ExpressionAnalyzer::Analyze(const parser::CallStmt &callStmt) {
|
||||
auto expr{AnalyzeCall(callStmt.v, true)};
|
||||
if (auto *procRef{UnwrapExpr<ProcedureRef>(expr)}) {
|
||||
callStmt.typedCall.reset(new ProcedureRef{*procRef});
|
||||
MaybeExpr expr{AnalyzeCall(callStmt.v, true)};
|
||||
if (const auto *proc{UnwrapExpr<ProcedureRef>(expr)}) {
|
||||
callStmt.typedCall.reset(new ProcedureRef{*proc});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1840,8 +1840,12 @@ MaybeExpr ExpressionAnalyzer::AnalyzeCall(
|
|||
GetCalleeAndArguments(std::get<parser::ProcedureDesignator>(call.t),
|
||||
analyzer.GetActuals(), isSubroutine)}) {
|
||||
if (isSubroutine) {
|
||||
CheckCall(call.source, callee->procedureDesignator, callee->arguments);
|
||||
// TODO: Package the subroutine call as an expr in the parse tree
|
||||
if (CheckCall(
|
||||
call.source, callee->procedureDesignator, callee->arguments)) {
|
||||
return Expr<SomeType>{
|
||||
ProcedureRef{std::move(callee->procedureDesignator),
|
||||
std::move(callee->arguments)}};
|
||||
}
|
||||
} else {
|
||||
return MakeFunctionRef(call.source,
|
||||
std::move(callee->procedureDesignator),
|
||||
|
|
Loading…
Reference in New Issue