[llvm] [orc-rt] Add Error / Exception interop. (PR #172247)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 14 20:52:19 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 origin/main HEAD --extensions cpp,h -- orc-rt/lib/executor/Error.cpp orc-rt/unittests/ErrorExceptionInteropTest.cpp orc-rt/include/orc-rt/Error.h orc-rt/unittests/ErrorTest.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/orc-rt/unittests/ErrorExceptionInteropTest.cpp b/orc-rt/unittests/ErrorExceptionInteropTest.cpp
index dd106f14e..e7cd34ae3 100644
--- a/orc-rt/unittests/ErrorExceptionInteropTest.cpp
+++ b/orc-rt/unittests/ErrorExceptionInteropTest.cpp
@@ -181,33 +181,33 @@ TEST(ErrorExceptionInteropTest, ErrorExceptionToString) {
class MyException : public std::exception {
public:
~MyException() override {}
- const char *what() const noexcept override { return "what"; }
- };
+ const char *what() const noexcept override { return "what";
+}
+}
+;
- EXPECT_EQ(toString(runCapturingExceptions([]() { throw MyException(); })),
- "what");
- }
+EXPECT_EQ(toString(runCapturingExceptions([]() { throw MyException(); })),
+ "what");
+}
- {
- // std::error_code should be converted by calling `.message()`.
- auto EC = std::make_error_code(std::errc::cross_device_link);
- std::string ECErrMsg = EC.message();
- EXPECT_EQ(toString(runCapturingExceptions([&]() { throw EC; })),
- ECErrMsg);
- }
+{
+ // std::error_code should be converted by calling `.message()`.
+ auto EC = std::make_error_code(std::errc::cross_device_link);
+ std::string ECErrMsg = EC.message();
+ EXPECT_EQ(toString(runCapturingExceptions([&]() { throw EC; })), ECErrMsg);
+}
- {
- // std::string should be converted by copying its value.
- std::string ErrMsg = "foo";
- EXPECT_EQ(toString(runCapturingExceptions([&]() { throw ErrMsg; })),
- ErrMsg);
- }
+{
+ // std::string should be converted by copying its value.
+ std::string ErrMsg = "foo";
+ EXPECT_EQ(toString(runCapturingExceptions([&]() { throw ErrMsg; })), ErrMsg);
+}
- {
- // Check that exceptions of other types produce the expected
- // "unrecognized type" error message:
- EXPECT_EQ(toString(runCapturingExceptions([]() { throw 42; })),
- "C++ exception of unknown type");
- }
- });
+{
+ // Check that exceptions of other types produce the expected
+ // "unrecognized type" error message:
+ EXPECT_EQ(toString(runCapturingExceptions([]() { throw 42; })),
+ "C++ exception of unknown type");
+}
+});
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/172247
More information about the llvm-commits
mailing list