[flang-commits] [flang] 4fae60c - [flang] Add runtime interface for GET_COMMAND_ARGUMENT
Diana Picus via flang-commits
flang-commits at lists.llvm.org
Mon Aug 30 00:41:49 PDT 2021
Author: Diana Picus
Date: 2021-08-30T07:31:13Z
New Revision: 4fae60c4b0ed02dbb6e4c73e49197dd8dd8d4ccf
URL: https://github.com/llvm/llvm-project/commit/4fae60c4b0ed02dbb6e4c73e49197dd8dd8d4ccf
DIFF: https://github.com/llvm/llvm-project/commit/4fae60c4b0ed02dbb6e4c73e49197dd8dd8d4ccf.diff
LOG: [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
Added:
Modified:
flang/runtime/command.h
Removed:
################################################################################
diff --git a/flang/runtime/command.h b/flang/runtime/command.h
index a2e23fca318d5..8367d7c33ad88 100644
--- a/flang/runtime/command.h
+++ b/flang/runtime/command.h
@@ -13,12 +13,29 @@
#include "entry-names.h"
namespace Fortran::runtime {
+class Descriptor;
+
extern "C" {
// 16.9.51 COMMAND_ARGUMENT_COUNT
//
// Lowering may need to cast the result to match the precision of the default
// integer kind.
CppTypeFor<TypeCategory::Integer, 4> RTNAME(ArgumentCount)();
+
+// 16.9.83 GET_COMMAND_ARGUMENT
+// We're breaking up the interface into several
diff erent functions, since most
+// of the parameters are optional.
+
+// Try to get the value of the n'th argument.
+// Returns a STATUS as described in the standard.
+CppTypeFor<TypeCategory::Integer, 4> RTNAME(ArgumentValue)(
+ CppTypeFor<TypeCategory::Integer, 4> n, const Descriptor *value,
+ const Descriptor *errmsg);
+
+// Try to get the significant length of the n'th argument.
+// Returns 0 if it doesn't manage.
+CppTypeFor<TypeCategory::Integer, 4> RTNAME(ArgumentLength)(
+ CppTypeFor<TypeCategory::Integer, 4> n);
}
} // namespace Fortran::runtime
More information about the flang-commits
mailing list