Skip to content

Commit c77ef6e

Browse files
rovkajeanPerier
authored andcommitted
[flang] Add runtime interface for GET_COMMAND_ARGUMENT
GET_COMMAND_ARGUMENT takes a lot of optional arguments: VALUE, LENGTH, STATUS and ERRMSG. This patch breaks up the interface into 2 different functions: * One for getting the LENGTH of an argument. * One for getting the VALUE and the ERRMSG of an argument. This returns the STATUS, which can be easily ignored by lowering if it is missing in the invocation. Differential Revision: https://reviews.llvm.org/D108688
1 parent bb06cb0 commit c77ef6e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

flang/runtime/command.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,29 @@
1313
#include "entry-names.h"
1414

1515
namespace Fortran::runtime {
16+
class Descriptor;
17+
1618
extern "C" {
1719
// 16.9.51 COMMAND_ARGUMENT_COUNT
1820
//
1921
// Lowering may need to cast the result to match the precision of the default
2022
// integer kind.
2123
CppTypeFor<TypeCategory::Integer, 4> RTNAME(ArgumentCount)();
24+
25+
// 16.9.83 GET_COMMAND_ARGUMENT
26+
// We're breaking up the interface into several different functions, since most
27+
// of the parameters are optional.
28+
29+
// Try to get the value of the n'th argument.
30+
// Returns a STATUS as described in the standard.
31+
CppTypeFor<TypeCategory::Integer, 4> RTNAME(ArgumentValue)(
32+
CppTypeFor<TypeCategory::Integer, 4> n, const Descriptor *value,
33+
const Descriptor *errmsg);
34+
35+
// Try to get the significant length of the n'th argument.
36+
// Returns 0 if it doesn't manage.
37+
CppTypeFor<TypeCategory::Integer, 4> RTNAME(ArgumentLength)(
38+
CppTypeFor<TypeCategory::Integer, 4> n);
2239
}
2340
} // namespace Fortran::runtime
2441

0 commit comments

Comments
 (0)