[llvm] [LLVM][Support] Add new CreateFileError functions (PR #125906)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 10:47:55 PST 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 1c7625b350755a1e2873282c125ca91691a1a7d6 b7bf7a539eec38b902d41a3762a5d7fe3ab8a1cc --extensions h,cpp -- llvm/include/llvm/Support/Error.h llvm/unittests/Support/ErrorTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index 48e17aabc1..c1b809a09b 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -1404,15 +1404,16 @@ inline Error createFileError(const Twine &F, size_t Line, std::error_code EC) {
   return createFileError(F, Line, errorCodeToError(EC));
 }
 
-/// Create a StringError with the specified error code and prepend the file path to it.
+/// Create a StringError with the specified error code and prepend the file path
+/// to it.
 inline Error createFileError(const Twine &F, std::error_code EC,
                              const Twine &S) {
   Error E = createStringError(EC, S);
   return createFileError(F, std::move(E));
 }
 
-
-/// Create a StringError with the specified error code and prepend the file path to it.
+/// Create a StringError with the specified error code and prepend the file path
+/// to it.
 template <typename... Ts>
 inline Error createFileError(const Twine &F, std::error_code EC,
                              char const *Fmt, const Ts &...Vals) {
diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp
index b84fd621f7..00c562ecc0 100644
--- a/llvm/unittests/Support/ErrorTest.cpp
+++ b/llvm/unittests/Support/ErrorTest.cpp
@@ -977,12 +977,15 @@ TEST(Error, FileErrorTest) {
     EXPECT_EQ(F->messageWithoutFileInfo(), "CustomError {6}");
   });
 
-  Error FE7 = createFileError("file.bin", make_error_code(std::errc::invalid_argument), "invalid argument");
+  Error FE7 =
+      createFileError("file.bin", make_error_code(std::errc::invalid_argument),
+                      "invalid argument");
   EXPECT_EQ(toString(std::move(FE7)), "'file.bin': invalid argument");
 
   StringRef Argument = "arg";
-  Error FE8 = createFileError("file.bin", make_error_code(std::errc::invalid_argument),
-                              "invalid argument '%s'", Argument.str().c_str());
+  Error FE8 =
+      createFileError("file.bin", make_error_code(std::errc::invalid_argument),
+                      "invalid argument '%s'", Argument.str().c_str());
   EXPECT_EQ(toString(std::move(FE8)), "'file.bin': invalid argument 'arg'");
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/125906


More information about the llvm-commits mailing list