[flang-commits] [flang] [flang] fix VLA using malloc and avoid using std::vector, arg input type change to char * from std::byte (PR #77911)
via flang-commits
flang-commits at lists.llvm.org
Fri Jan 12 04:12:11 PST 2024
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 35c19fdde2583e74d940f6cd47b97a5c28bfe368 9d0aea77a5bbccf1e0b0e6c0f259af22ad4793e8 -- flang/include/flang/Runtime/extensions.h flang/runtime/extensions.cpp flang/unittests/Runtime/CommandTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/runtime/extensions.cpp b/flang/runtime/extensions.cpp
index 7340895744..ef6f0aba46 100644
--- a/flang/runtime/extensions.cpp
+++ b/flang/runtime/extensions.cpp
@@ -48,8 +48,7 @@ extern "C" {
namespace Fortran::runtime {
-void GetUsernameEnvVar(
- const char *envName, char *arg, std::int64_t length) {
+void GetUsernameEnvVar(const char *envName, char *arg, std::int64_t length) {
Descriptor name{*Descriptor::Create(
1, std::strlen(envName) + 1, const_cast<char *>(envName), 0)};
Descriptor value{*Descriptor::Create(1, length, arg, 0)};
@@ -121,7 +120,7 @@ void FORTRAN_PROCEDURE_NAME(getlog)(char *arg, std::int64_t length) {
// error occur: get username from environment variable
GetUsernameEnvVar("LOGNAME", arg, length);
}
- FreeMemory((void*)str);
+ FreeMemory((void *)str);
#elif _WIN32
// Get username from environment to avoid link to Advapi32.lib
GetUsernameEnvVar("USERNAME", arg, length);
diff --git a/flang/unittests/Runtime/CommandTest.cpp b/flang/unittests/Runtime/CommandTest.cpp
index fda5f00c57..c0c0b21556 100644
--- a/flang/unittests/Runtime/CommandTest.cpp
+++ b/flang/unittests/Runtime/CommandTest.cpp
@@ -9,12 +9,12 @@
#include "flang/Runtime/command.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#include "../../runtime/terminator.h"
#include "flang/Runtime/descriptor.h"
#include "flang/Runtime/execute.h"
#include "flang/Runtime/extensions.h"
#include "flang/Runtime/main.h"
#include "flang/Runtime/memory.h"
-#include "../../runtime/terminator.h"
#include <cstddef>
#include <cstdlib>
``````````
</details>
https://github.com/llvm/llvm-project/pull/77911
More information about the flang-commits
mailing list