<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Support/ErrorHandling.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>ErrorHandling: Check for EINTR and partial writes (#147595)</title>
<updated>2025-07-09T18:19:21+00:00</updated>
<author>
<name>Matthias Braun</name>
<email>matze@braunis.de</email>
</author>
<published>2025-07-09T18:19:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=bdc0119e1b6001be813a540134bd1772b4d9c4dc'/>
<id>bdc0119e1b6001be813a540134bd1772b4d9c4dc</id>
<content type='text'>
Calls to the posix `write` function can return -1 and set errno to
`EINTR` or perform partial writes when interrupted by signals. In those
cases applications are supposed to just try again. See for example the
documentation in glibc:
https://sourceware.org/glibc/manual/latest/html_node/I_002fO-Primitives.html#index-write

This fixes the uses in `ErrorHandling.cpp` to retry as needed.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Calls to the posix `write` function can return -1 and set errno to
`EINTR` or perform partial writes when interrupted by signals. In those
cases applications are supposed to just try again. See for example the
documentation in glibc:
https://sourceware.org/glibc/manual/latest/html_node/I_002fO-Primitives.html#index-write

This fixes the uses in `ErrorHandling.cpp` to retry as needed.</pre>
</div>
</content>
</entry>
<entry>
<title>[ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (#138251)</title>
<updated>2025-05-05T10:10:03+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2025-05-05T10:10:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b492ec5899082af9f34d79be9750b5e5c5d082e1'/>
<id>b492ec5899082af9f34d79be9750b5e5c5d082e1</id>
<content type='text'>
This implements the result of the discussion at:

https://discourse.llvm.org/t/rfc-report-fatal-error-and-the-default-value-of-gencrashdialog/73587

There are two different use cases for report_fatal_error, so replace it
with two functions reportFatalInternalError() and
reportFatalUsageError(). The former indicates a bug in LLVM and
generates a crash dialog. The latter does not. The names have been
suggested by rnk and people seemed to like them.

This replaces a lot of the usages that passed an explicit value for
GenCrashDiag. I did not bulk replace remaining report_fatal_error usage
-- they probably require case by case review for which function to use.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements the result of the discussion at:

https://discourse.llvm.org/t/rfc-report-fatal-error-and-the-default-value-of-gencrashdialog/73587

There are two different use cases for report_fatal_error, so replace it
with two functions reportFatalInternalError() and
reportFatalUsageError(). The former indicates a bug in LLVM and
generates a crash dialog. The latter does not. The names have been
suggested by rnk and people seemed to like them.

This replaces a lot of the usages that passed an explicit value for
GenCrashDiag. I did not bulk replace remaining report_fatal_error usage
-- they probably require case by case review for which function to use.</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] Remove an unnecessary include (#123182)</title>
<updated>2025-01-16T20:47:22+00:00</updated>
<author>
<name>Martin Storsjö</name>
<email>martin@martin.st</email>
</author>
<published>2025-01-16T20:47:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=94609aee73d7123bc9afe002a4987d06eba9f452'/>
<id>94609aee73d7123bc9afe002a4987d06eba9f452</id>
<content type='text'>
In 1e53f9523d3d5fcb2993b4b6540f1ed8d743380b, the FileSystem.h header was
changed to always include &lt;sys/stat.h&gt;, while it previously only was
included if HAVE_SYS_STAT_H was defined.

HAVE_SYS_STAT_H was defined in llvm/Config/config.h, while FileSystem.h
only included llvm/Config/llvm-config.h. Thus, &lt;sys/stat.h&gt; was only
being included in some but not all cases.

The change to always include &lt;sys/stat.h&gt; broke compiling LLDB for MinGW
targets, because the MinGW &lt;sys/stat.h&gt; header adds an "#define fstat
_fstat64" define, which breaks LLDBs use of a struct with a member named
"fstat".

Remove the include of &lt;sys/stat.h&gt; in FileSystem.h, as it seems to not
be necessary in practice, fixing compilation of LLDB for MinGW targets.

Change one instance of defined(_MSC_VER) into defined(_WIN32) in
ErrorHandling.cpp to get &lt;io.h&gt; included; this source file did include
config.h before transitively including FileSystem.h. The include of
&lt;sys/stat.h&gt; in FileSystem.h would bring in &lt;io.h&gt; (needed for
::write()), explaining why this ifdef didn't need to cover MinGW before.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In 1e53f9523d3d5fcb2993b4b6540f1ed8d743380b, the FileSystem.h header was
changed to always include &lt;sys/stat.h&gt;, while it previously only was
included if HAVE_SYS_STAT_H was defined.

HAVE_SYS_STAT_H was defined in llvm/Config/config.h, while FileSystem.h
only included llvm/Config/llvm-config.h. Thus, &lt;sys/stat.h&gt; was only
being included in some but not all cases.

The change to always include &lt;sys/stat.h&gt; broke compiling LLDB for MinGW
targets, because the MinGW &lt;sys/stat.h&gt; header adds an "#define fstat
_fstat64" define, which breaks LLDBs use of a struct with a member named
"fstat".

Remove the include of &lt;sys/stat.h&gt; in FileSystem.h, as it seems to not
be necessary in practice, fixing compilation of LLDB for MinGW targets.

Change one instance of defined(_MSC_VER) into defined(_WIN32) in
ErrorHandling.cpp to get &lt;io.h&gt; included; this source file did include
config.h before transitively including FileSystem.h. The include of
&lt;sys/stat.h&gt; in FileSystem.h would bring in &lt;io.h&gt; (needed for
::write()), explaining why this ifdef didn't need to cover MinGW before.</pre>
</div>
</content>
</entry>
<entry>
<title>[NFC] Add explicit #include llvm-config.h where its macros are used. (#106621)</title>
<updated>2024-08-30T07:35:06+00:00</updated>
<author>
<name>Daniil Fukalov</name>
<email>dfukalov@gmail.com</email>
</author>
<published>2024-08-30T07:35:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=89e6a288674c9fae33aeb5448c7b1fe782b2bf53'/>
<id>89e6a288674c9fae33aeb5448c7b1fe782b2bf53</id>
<content type='text'>
Without these explicit includes, removing other headers, who implicitly
include llvm-config.h, may have non-trivial side effects.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Without these explicit includes, removing other headers, who implicitly
include llvm-config.h, may have non-trivial side effects.</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] Handle delete_pending case for Windows fs::status (#90655)</title>
<updated>2024-06-03T17:22:44+00:00</updated>
<author>
<name>Jeremy Day</name>
<email>jeremy@thebrowser.company</email>
</author>
<published>2024-06-03T17:22:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cb7690af09b95bb944baf1b5a9ffb18f86c12130'/>
<id>cb7690af09b95bb944baf1b5a9ffb18f86c12130</id>
<content type='text'>
If a delete is pending on the file queried for status, a misleading
`permission_denied` error code will be returned (this is the correct
mapping of the error set by GetFileAttributesW). By querying the
underlying NTSTATUS code via ntdll's RtlGetLastNtStatus, this case can
be disambiguated. If this underlying error code indicates a pending
delete, fs::status will return a new `pending_delete` error code to be
handled by callers

Fixes #89137</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If a delete is pending on the file queried for status, a misleading
`permission_denied` error code will be returned (this is the correct
mapping of the error set by GetFileAttributesW). By querying the
underlying NTSTATUS code via ntdll's RtlGetLastNtStatus, this case can
be disambiguated. If this underlying error code indicates a pending
delete, fs::status will return a new `pending_delete` error code to be
handled by callers

Fixes #89137</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] Fix crash in install_bad_alloc_error_handler (#83160)</title>
<updated>2024-03-01T19:53:54+00:00</updated>
<author>
<name>Fabian Schiebel</name>
<email>52407375+fabianbs96@users.noreply.github.com</email>
</author>
<published>2024-03-01T19:53:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1685e7fdab3f1b3fc654f7c93219594532becb81'/>
<id>1685e7fdab3f1b3fc654f7c93219594532becb81</id>
<content type='text'>
Previously, the function `install_bad_alloc_error_handler` was asserting that a bad_alloc error handler was not already installed. However, it was actually checking for the fatal-error handler, not for the bad_alloc error handler, causing an assertion failure if a fatal-error handler was already installed.

Fixes #83040</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, the function `install_bad_alloc_error_handler` was asserting that a bad_alloc error handler was not already installed. However, it was actually checking for the fatal-error handler, not for the bad_alloc error handler, causing an assertion failure if a fatal-error handler was already installed.

Fixes #83040</pre>
</div>
</content>
</entry>
<entry>
<title>fix tests after my commit 80b3dcc045f8ea6e5e532d8891bbf1305bce89e8</title>
<updated>2022-05-30T18:44:06+00:00</updated>
<author>
<name>Nuno Lopes</name>
<email>nuno.lopes@tecnico.ulisboa.pt</email>
</author>
<published>2022-05-30T18:44:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8c55de9ee7f63a26e6edf7bcf4279f64602b3bf1'/>
<id>8c55de9ee7f63a26e6edf7bcf4279f64602b3bf1</id>
<content type='text'>
 doesn't like exit code 126 I'm afraid
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
 doesn't like exit code 126 I'm afraid
</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] Make report_fatal_error respect its GenCrashDiag argument so it doesn't generate a backtrace</title>
<updated>2022-05-30T18:19:23+00:00</updated>
<author>
<name>Nuno Lopes</name>
<email>nuno.lopes@tecnico.ulisboa.pt</email>
</author>
<published>2022-05-30T18:16:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=80b3dcc045f8ea6e5e532d8891bbf1305bce89e8'/>
<id>80b3dcc045f8ea6e5e532d8891bbf1305bce89e8</id>
<content type='text'>
There are a few places where we use report_fatal_error when the input is broken.
Currently, this function always crashes LLVM with an abort signal, which
then triggers the backtrace printing code.
I think this is excessive, as wrong input shouldn't give a link to
LLVM's github issue URL and tell users to file a bug report.
We shouldn't print a stack trace either.

This patch changes report_fatal_error so it uses exit() rather than
abort() when its argument GenCrashDiag=false.

Reviewed by: nikic, MaskRay, RKSimon

Differential Revision: https://reviews.llvm.org/D126550
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are a few places where we use report_fatal_error when the input is broken.
Currently, this function always crashes LLVM with an abort signal, which
then triggers the backtrace printing code.
I think this is excessive, as wrong input shouldn't give a link to
LLVM's github issue URL and tell users to file a bug report.
We shouldn't print a stack trace either.

This patch changes report_fatal_error so it uses exit() rather than
abort() when its argument GenCrashDiag=false.

Reviewed by: nikic, MaskRay, RKSimon

Differential Revision: https://reviews.llvm.org/D126550
</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] Add more Windows error codes to mapWindowsError</title>
<updated>2021-10-16T13:14:49+00:00</updated>
<author>
<name>Martin Storsjö</name>
<email>martin@martin.st</email>
</author>
<published>2021-10-04T21:03:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=6c96ceabaf84d149244a15916ce53df95aac3660'/>
<id>6c96ceabaf84d149244a15916ce53df95aac3660</id>
<content type='text'>
Also sort ERROR_BAD_NETPATH correctly.

Compared with the similar error code mapping in
libcxx/src/filesystem/operations.cpp, I'm leaving out
mappings for ERROR_NOT_SAME_DEVICE and ERROR_OPERATION_ABORTED.
They map nicely to std::errc::cross_device_link and
std::errc::operation_canceled, but those aren't available in
llvm::errc, as they aren't available across all platforms.

Also, the libcxx version maps ERROR_INVALID_NAME to
no_such_file_or_directory instead of invalid_argument.

Differential Revision: https://reviews.llvm.org/D111874
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also sort ERROR_BAD_NETPATH correctly.

Compared with the similar error code mapping in
libcxx/src/filesystem/operations.cpp, I'm leaving out
mappings for ERROR_NOT_SAME_DEVICE and ERROR_OPERATION_ABORTED.
They map nicely to std::errc::cross_device_link and
std::errc::operation_canceled, but those aren't available in
llvm::errc, as they aren't available across all platforms.

Also, the libcxx version maps ERROR_INVALID_NAME to
no_such_file_or_directory instead of invalid_argument.

Differential Revision: https://reviews.llvm.org/D111874
</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] ErrorHandling.h - Remove report_fatal_error(std::string)</title>
<updated>2021-10-06T13:32:38+00:00</updated>
<author>
<name>Simon Pilgrim</name>
<email>llvm-dev@redking.me.uk</email>
</author>
<published>2021-10-06T13:30:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f6fa95b77f33c3690e4201e505cb8dce1433abd9'/>
<id>f6fa95b77f33c3690e4201e505cb8dce1433abd9</id>
<content type='text'>
As described on D111049, removing the &lt;string&gt; dependency from error handling removes considerable build overhead, its recommended that the report_fatal_error(Twine) variant is used instead.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As described on D111049, removing the &lt;string&gt; dependency from error handling removes considerable build overhead, its recommended that the report_fatal_error(Twine) variant is used instead.
</pre>
</div>
</content>
</entry>
</feed>
