[flang] [llvm] [flang][intrinsic] add nonstandard intrinsic unlink (PR #134162)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 2 15:04:41 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- flang-rt/lib/runtime/command.cpp flang/include/flang/Optimizer/Builder/IntrinsicCall.h flang/include/flang/Optimizer/Builder/Runtime/Command.h flang/include/flang/Runtime/command.h flang/lib/Evaluate/intrinsics.cpp flang/lib/Optimizer/Builder/IntrinsicCall.cpp flang/lib/Optimizer/Builder/Runtime/Command.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang-rt/lib/runtime/command.cpp b/flang-rt/lib/runtime/command.cpp
index 0dda8cb22..71f81b788 100644
--- a/flang-rt/lib/runtime/command.cpp
+++ b/flang-rt/lib/runtime/command.cpp
@@ -12,8 +12,8 @@
#include "flang-rt/runtime/stat.h"
#include "flang-rt/runtime/terminator.h"
#include "flang-rt/runtime/tools.h"
-#include <cstdlib>
#include <cerrno>
+#include <cstdlib>
#include <limits>
#ifdef _WIN32
diff --git a/flang/include/flang/Runtime/command.h b/flang/include/flang/Runtime/command.h
index 089fdba2e..2878a3eb2 100644
--- a/flang/include/flang/Runtime/command.h
+++ b/flang/include/flang/Runtime/command.h
@@ -65,8 +65,8 @@ std::int32_t RTNAME(Hostnm)(
const Descriptor &res, const char *sourceFile, int line);
// Calls unlink()
-std::int32_t RTNAME(Unlink)(
- const char *str, const std::size_t strLength, const char *sourceFile, int line);
+std::int32_t RTNAME(Unlink)(const char *str, const std::size_t strLength,
+ const char *sourceFile, int line);
} // extern "C"
} // namespace Fortran::runtime
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index 9537d5176..0eb841949 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -1010,8 +1010,8 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
KINDUnsigned},
{"umaskl", {{"i", AnyInt}, DefaultingKIND}, KINDUnsigned},
{"umaskr", {{"i", AnyInt}, DefaultingKIND}, KINDUnsigned},
- {"unlink", {{"path", DefaultChar, Rank::scalar}}, DefaultInt,
- Rank::scalar, IntrinsicClass::transformationalFunction},
+ {"unlink", {{"path", DefaultChar, Rank::scalar}}, DefaultInt, Rank::scalar,
+ IntrinsicClass::transformationalFunction},
{"unpack",
{{"vector", SameType, Rank::vector}, {"mask", AnyLogical, Rank::array},
{"field", SameType, Rank::conformable}},
@@ -1636,8 +1636,10 @@ static const IntrinsicInterface intrinsicSubroutine[]{
common::Intent::In}},
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
{"unlink",
- {{"path", DefaultChar, Rank::scalar, Optionality::required, common::Intent::In},
- {"status", DefaultInt, Rank::scalar, Optionality::optional, common::Intent::Out}},
+ {{"path", DefaultChar, Rank::scalar, Optionality::required,
+ common::Intent::In},
+ {"status", DefaultInt, Rank::scalar, Optionality::optional,
+ common::Intent::Out}},
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
};
diff --git a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
index 7d5e85e58..2303e79c9 100644
--- a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
+++ b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
@@ -8534,7 +8534,8 @@ IntrinsicLibrary::genUnlink(std::optional<mlir::Type> resultType,
mlir::Value path = fir::getBase(args[0]);
mlir::Value pathLength = fir::getLen(args[0]);
- mlir::Value statusValue = fir::runtime::genUnlink(builder, loc, path, pathLength);
+ mlir::Value statusValue =
+ fir::runtime::genUnlink(builder, loc, path, pathLength);
if (resultType.has_value()) {
// Function form, return status.
diff --git a/flang/lib/Optimizer/Builder/Runtime/Command.cpp b/flang/lib/Optimizer/Builder/Runtime/Command.cpp
index 76c7a6e2a..27ea59618 100644
--- a/flang/lib/Optimizer/Builder/Runtime/Command.cpp
+++ b/flang/lib/Optimizer/Builder/Runtime/Command.cpp
@@ -127,8 +127,8 @@ void fir::runtime::genPerror(fir::FirOpBuilder &builder, mlir::Location loc,
}
mlir::Value fir::runtime::genUnlink(fir::FirOpBuilder &builder,
- mlir::Location loc,
- mlir::Value path, mlir::Value pathLength) {
+ mlir::Location loc, mlir::Value path,
+ mlir::Value pathLength) {
mlir::func::FuncOp func =
fir::runtime::getRuntimeFunc<mkRTKey(Unlink)>(loc, builder);
auto runtimeFuncTy = func.getFunctionType();
``````````
</details>
https://github.com/llvm/llvm-project/pull/134162
More information about the llvm-commits
mailing list