Skip to content

Commit 34bba44

Browse files
authored
Merge pull request #1000 from flang-compiler/jpr-elemental-explicit-result
Lower elemental character function and elemental internal procedure
2 parents 23d1a17 + 9f25471 commit 34bba44

File tree

5 files changed

+310
-228
lines changed

5 files changed

+310
-228
lines changed

flang/include/flang/Lower/CallInterface.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#define FORTRAN_LOWER_CALLINTERFACE_H
2929

3030
#include "flang/Common/reference.h"
31+
#include "flang/Evaluate/characteristics.h"
3132
#include "mlir/IR/BuiltinOps.h"
3233
#include <memory>
3334
#include <optional>
@@ -40,19 +41,6 @@ namespace mlir {
4041
class Location;
4142
}
4243

43-
namespace Fortran::evaluate {
44-
class ProcedureRef;
45-
struct ProcedureDesignator;
46-
class ActualArgument;
47-
template <typename T>
48-
class Expr;
49-
struct SomeType;
50-
namespace characteristics {
51-
struct Procedure;
52-
struct DummyArgument;
53-
} // namespace characteristics
54-
} // namespace Fortran::evaluate
55-
5644
namespace Fortran::lower {
5745
class AbstractConverter;
5846
class SymMap;
@@ -238,7 +226,8 @@ class CallInterface {
238226
Fortran::lower::AbstractConverter &converter;
239227
/// Store characteristic once created, it is required for further information
240228
/// (e.g. getting the length of character result)
241-
std::unique_ptr<Fortran::evaluate::characteristics::Procedure> characteristic;
229+
std::optional<Fortran::evaluate::characteristics::Procedure> characteristic =
230+
std::nullopt;
242231
};
243232

244233
//===----------------------------------------------------------------------===//

flang/lib/Lower/CallInterface.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "flang/Lower/CallInterface.h"
1010
#include "StatementContext.h"
11-
#include "flang/Evaluate/characteristics.h"
1211
#include "flang/Evaluate/fold.h"
1312
#include "flang/Lower/Bridge.h"
1413
#include "flang/Lower/FIRBuilder.h"
@@ -347,9 +346,7 @@ static void addSymbolAttribute(mlir::FuncOp func,
347346
template <typename T>
348347
void Fortran::lower::CallInterface<T>::declare() {
349348
if (!side().isMainProgram()) {
350-
characteristic =
351-
std::make_unique<Fortran::evaluate::characteristics::Procedure>(
352-
side().characterize());
349+
characteristic.emplace(side().characterize());
353350
auto isImplicit = characteristic->CanBeCalledViaImplicitInterface();
354351
determineInterface(isImplicit, *characteristic);
355352
}

0 commit comments

Comments
 (0)