Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0 |
|
#
459a82e6 |
| 13-Sep-2024 |
JOE1994 <joseph942010@gmail.com> |
[llvm][unittests] Don't call raw_string_ostream::flush() (NFC)
raw_string_ostream::flush() is essentially a no-op (also specified in docs). Don't call it in tests that aren't meant to test 'raw_stri
[llvm][unittests] Don't call raw_string_ostream::flush() (NFC)
raw_string_ostream::flush() is essentially a no-op (also specified in docs). Don't call it in tests that aren't meant to test 'raw_string_ostream' itself.
p.s. remove a few redundant calls to raw_string_ostream::str()
show more ...
|
#
77bab2a6 |
| 13-Sep-2024 |
JOE1994 <joseph942010@gmail.com> |
[llvm][unittests] Strip unneeded use of raw_string_ostream::str() (NFC)
Avoid unneeded layer of indirection.
|
Revision tags: llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2 |
|
#
45ef0d49 |
| 31-Jul-2024 |
David Blaikie <dblaikie@gmail.com> |
Add llvm::Error C API, LLVMCantFail
It's barely testable - the test does exercise the code, but wouldn't fail on an empty implementation. It would cause a memory leak though (because the error handl
Add llvm::Error C API, LLVMCantFail
It's barely testable - the test does exercise the code, but wouldn't fail on an empty implementation. It would cause a memory leak though (because the error handle wouldn't be unwrapped/reowned) which could be detected by asan and other leak detectors.
show more ...
|
Revision tags: llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8 |
|
#
44df1167 |
| 14-Jun-2024 |
Nikita Popov <npopov@redhat.com> |
[Error] Add non-consuming toString (#95375)
There are some places that want to convert an Error to string, but still
retain the original Error object, for example to emit a non-fatal
warning.
T
[Error] Add non-consuming toString (#95375)
There are some places that want to convert an Error to string, but still
retain the original Error object, for example to emit a non-fatal
warning.
This currently isn't possible, because the entire Error infra is
move-based. And what people end up doing in this case is to move the
Error... twice.
This patch introduces a toStringWithoutConsuming() function to
accommodate this use case. This also requires some infrastructure that
allows visiting Errors without consuming them.
show more ...
|
Revision tags: llvmorg-18.1.7, llvmorg-18.1.6 |
|
#
b5f6cc9e |
| 16-May-2024 |
Mircea Trofin <mtrofin@google.com> |
Unittest for Error forwarding, follow-up to PR #92208 (#92314)
Added a unittest demonstrating Error -> Expected<T> forwarding.
|
Revision tags: llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1 |
|
#
1685e7fd |
| 01-Mar-2024 |
Fabian Schiebel <52407375+fabianbs96@users.noreply.github.com> |
[Support] Fix crash in install_bad_alloc_error_handler (#83160)
Previously, the function `install_bad_alloc_error_handler` was asserting that a bad_alloc error handler was not already installed. How
[Support] Fix crash in install_bad_alloc_error_handler (#83160)
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
show more ...
|
Revision tags: llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3 |
|
#
164055f8 |
| 17-Feb-2024 |
Alex Langford <alangford@apple.com> |
Revert "[Support] Introduce formatv variant of createStringError" (#82126)
Reverts llvm/llvm-project#80493
This increased clang compile times by 0.5%. I'll figure out a less
expensive way to ach
Revert "[Support] Introduce formatv variant of createStringError" (#82126)
Reverts llvm/llvm-project#80493
This increased clang compile times by 0.5%. I'll figure out a less
expensive way to achieve this.
show more ...
|
#
4bb0ca65 |
| 17-Feb-2024 |
Alex Langford <alangford@apple.com> |
[Support] Introduce formatv variant of createStringError (#80493)
Many times I have found myself wanting to create a StringError with the
ability to interpolate a StringRef into the error string. T
[Support] Introduce formatv variant of createStringError (#80493)
Many times I have found myself wanting to create a StringError with the
ability to interpolate a StringRef into the error string. This can be
achieved with:
StringRef Foo("...");
auto Err = createStringError(..., "Something went wrong: %s",
Foo.str().c_str());
However, this requires us to construct a temporary std::string (which
may perform a memory allocation if large enough).
I propose a new variant of `createStringError` called
`createStringErrorV` which uses `formatv` under the hood. This allows
the above example to become:
StringRef Foo("...");
auto Err = createStringErrorV(..., "Something went wrong: {0}", Foo);
show more ...
|
Revision tags: llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7 |
|
#
b1df3a2c |
| 16-Dec-2022 |
Fangrui Song <i@maskray.me> |
[Support] llvm::Optional => std::optional
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
|
#
b6a01caa |
| 03-Dec-2022 |
Kazu Hirata <kazu@google.com> |
[llvm/unittests] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the am
[llvm/unittests] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional.
This is part of an effort to migrate from llvm::Optional to std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
show more ...
|
Revision tags: llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init |
|
#
ede60037 |
| 29-Jun-2022 |
Nicolai Hähnle <nicolai.haehnle@amd.com> |
ManagedStatic: remove many straightforward uses in llvm
(Reapply after revert in e9ce1a588030d8d4004f5d7e443afe46245e9a92 due to Fuchsia test failures. Removed changes in lib/ExecutionEngine/ other
ManagedStatic: remove many straightforward uses in llvm
(Reapply after revert in e9ce1a588030d8d4004f5d7e443afe46245e9a92 due to Fuchsia test failures. Removed changes in lib/ExecutionEngine/ other than error categories, to be checked in more detail and reapplied separately.)
Bulk remove many of the more trivial uses of ManagedStatic in the llvm directory, either by defining a new getter function or, in many cases, moving the static variable directly into the only function that uses it.
Differential Revision: https://reviews.llvm.org/D129120
show more ...
|
#
e9ce1a58 |
| 10-Jul-2022 |
Nicolai Hähnle <nicolai.haehnle@amd.com> |
Revert "ManagedStatic: remove many straightforward uses in llvm"
This reverts commit e6f1f062457c928c18a88c612f39d9e168f65a85.
Reverting due to a failure on the fuchsia-x86_64-linux buildbot.
|
#
e6f1f062 |
| 29-Jun-2022 |
Nicolai Hähnle <nicolai.haehnle@amd.com> |
ManagedStatic: remove many straightforward uses in llvm
Bulk remove many of the more trivial uses of ManagedStatic in the llvm directory, either by defining a new getter function or, in many cases,
ManagedStatic: remove many straightforward uses in llvm
Bulk remove many of the more trivial uses of ManagedStatic in the llvm directory, either by defining a new getter function or, in many cases, moving the static variable directly into the only function that uses it.
Differential Revision: https://reviews.llvm.org/D129120
show more ...
|
Revision tags: llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1 |
|
#
c32f8f34 |
| 05-Apr-2022 |
Yuanfang Chen <yuanfang.chen@sony.com> |
[unittests] fix intermittent SupportTests failures
by invoking `SupportTests --gtest_shuffle=1`.
`HideUnrelatedOptions`/`HideUnrelatedOptionsMulti` failed due to other tests calling `cl::ResetComma
[unittests] fix intermittent SupportTests failures
by invoking `SupportTests --gtest_shuffle=1`.
`HideUnrelatedOptions`/`HideUnrelatedOptionsMulti` failed due to other tests calling `cl::ResetCommandLineParser()` which causes default options to be removed.
`ExitOnError` would hang due to the threading environment. Renaming it as `*Deathtest` is the recommended practice by GTest docs.
show more ...
|
Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init |
|
#
38ac4093 |
| 21-Jan-2022 |
Archibald Elliott <archibald.elliott@arm.com> |
[NFCI][Support] Avoid ASSERT_/EXPECT_TRUE(A <op> B)
The error messages in tests are far better when a test fails if the test is written using ASSERT_/EXPECT_<operator>(A, B) rather than ASSERT_/EXPE
[NFCI][Support] Avoid ASSERT_/EXPECT_TRUE(A <op> B)
The error messages in tests are far better when a test fails if the test is written using ASSERT_/EXPECT_<operator>(A, B) rather than ASSERT_/EXPECT_TRUE(A <operator> B).
This commit updates all of llvm/unittests/Support to use these macros where possible.
This change has not been possible in: - llvm/unittests/Support/FSUniqueIDTest.cpp - due to not overloading operators beyond ==, != and <. - llvm/unittests/Support/BranchProbabilityTest.cpp - where the unchanged tests are of the operator overloads themselves.
There are other possibilities of this conversion not being valid, which have not applied in these tests, as they do not use NULL (they use nullptr), and they do not use const char* (they use std::string or StringRef).
Reviewed By: mubashar_
Differential Revision: https://reviews.llvm.org/D117319
show more ...
|
Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4 |
|
#
79c54798 |
| 14-Sep-2021 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
Support: Pass wrapped Error's error code through FileError
Change FileError to pass through the error code from the Error it wraps. This allows APIs that return ECError to transition to FileError wi
Support: Pass wrapped Error's error code through FileError
Change FileError to pass through the error code from the Error it wraps. This allows APIs that return ECError to transition to FileError without changing returned std::error_code.
This was extracted from https://reviews.llvm.org/D109345.
Differential Revision: https://reviews.llvm.org/D113225
show more ...
|
#
27181cad |
| 20-Oct-2021 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
Support: Add Expected<T>::moveInto() to avoid extra names
Expected<T>::moveInto() takes as an out parameter any `OtherT&` that's assignable from `T&&`. It moves any stored value before returning tak
Support: Add Expected<T>::moveInto() to avoid extra names
Expected<T>::moveInto() takes as an out parameter any `OtherT&` that's assignable from `T&&`. It moves any stored value before returning takeError().
Since moveInto() consumes both the Error and the value, it's only anticipated that we'd use call it on temporaries/rvalues, with naming the Expected first likely to be an anti-pattern of sorts (either you want to deal with both at the same time, or you don't). As such, starting it out as `&&`-qualified... but it'd probably be fine to drop that if there's a good use case for lvalues that appears.
There are two common patterns that moveInto() cleans up: ``` // If the variable is new: Expected<std::unique_ptr<int>> ExpectedP = makePointer(); if (!ExpectedP) return ExpectedP.takeError(); std::unique_ptr<int> P = std::move(*ExpectedP);
// If the target variable already exists: if (Expected<T> ExpectedP = makePointer()) P = std::move(*ExpectedP); else return ExpectedP.takeError(); ``` moveInto() takes less typing and avoids needing to name (or leak into the scope) an extra variable. ``` // If the variable is new: std::unique_ptr<int> P; if (Error E = makePointer().moveInto(P)) return E;
// If the target variable already exists: if (Error E = makePointer().moveInto(P)) return E; ```
It also seems useful for unit tests, to log errors (but continue) when there's an unexpected failure. E.g.: ``` // Crash on error, or undefined in non-asserts builds. std::unique_ptr<MemoryBuffer> MB = cantFail(makeMemoryBuffer());
// Avoid crashing on error without moveInto() :(. Expected<std::unique_ptr<MemoryBuffer>> ExpectedMB = makeMemoryBuffer(); ASSERT_THAT_ERROR(ExpectedMB.takeError(), Succeeded()); std::unique_ptr<MemoryBuffer> MB = std::move(ExpectedMB);
// Avoid crashing on error with moveInto() :). std::unique_ptr<MemoryBuffer> MB; ASSERT_THAT_ERROR(makeMemoryBuffer().moveInto(MB), Succeeded()); ```
Differential Revision: https://reviews.llvm.org/D112278
show more ...
|
Revision tags: llvmorg-13.0.0-rc3 |
|
#
d18083c6 |
| 08-Sep-2021 |
David Blaikie <dblaikie@gmail.com> |
Error: Improve unit test by using gtest equality rather than explicit string compare calls
This ensures error messages from gtest includes the raw text of both sides of the comparison - otherwise al
Error: Improve unit test by using gtest equality rather than explicit string compare calls
This ensures error messages from gtest includes the raw text of both sides of the comparison - otherwise all gtest can report is the text of the expression source, without any information about the values or how they differ.
show more ...
|
#
f03689ac |
| 08-Sep-2021 |
David Blaikie <dblaikie@gmail.com> |
FileError: Provide a way to retrieve the underlying error string without the file name
For use with APIs that want to report the file name in a different syntactic form, have other knowledge of the
FileError: Provide a way to retrieve the underlying error string without the file name
For use with APIs that want to report the file name in a different syntactic form, have other knowledge of the filename, etc.
show more ...
|
#
0c502507 |
| 08-Sep-2021 |
David Blaikie <dblaikie@gmail.com> |
FileError: Support zero-length file names
It's a common error in an API - to try to open an empty file, so it seems like a reasonable FileError to produce "hey, you tried to open an empty file" and
FileError: Support zero-length file names
It's a common error in an API - to try to open an empty file, so it seems like a reasonable FileError to produce "hey, you tried to open an empty file" and to handle it the same way as any other file error.
show more ...
|
Revision tags: llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init |
|
#
7445f1e4 |
| 01-Jul-2021 |
xndcn <xndchn@gmail.com> |
[NFC] Mark Expected<T>::assertIsChecked() as const
Some const methods of Expected<T> invoke assertIsChecked(), so we should mark it as const too.
Differential Revision: https://reviews.llvm.org/D10
[NFC] Mark Expected<T>::assertIsChecked() as const
Some const methods of Expected<T> invoke assertIsChecked(), so we should mark it as const too.
Differential Revision: https://reviews.llvm.org/D105292
show more ...
|
Revision tags: llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3 |
|
#
b55c58a2 |
| 20-Feb-2020 |
Pavel Labath <pavel@labath.sk> |
[Error/unittests] Add a FailedWithMessage gtest matcher
Summary: We already have a "Failed" matcher, which can be used to check any property of the Error object. However, most frequently one just wa
[Error/unittests] Add a FailedWithMessage gtest matcher
Summary: We already have a "Failed" matcher, which can be used to check any property of the Error object. However, most frequently one just wants to check the error message, and while this is possible with the "Failed" matcher, it is also very convoluted (Failed<ErrorInfoBase>(testing::Property(&ErrorInfoBase::message, "the message"))).
Now, one can just write: FailedWithMessage("the message"). I expect that most of the usages will remain this simple, but the argument of the matcher is not limited to simple strings -- the argument of the matcher can be any other matcher, so one can write more complicated assertions if needed (FailedWithMessage(ContainsRegex("foo|bar"))). If one wants to match multiple error messages, he can pass multiple arguments to the matcher.
If one wants to match the message list as a whole (perhaps to check the message count), I've also included a FailedWithMessageArray matcher, which takes a single matcher receiving a vector of error message strings.
Reviewers: sammccall, dblaikie, jhenderson
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74898
show more ...
|
#
9746b3ae |
| 18-Feb-2020 |
Pavel Labath <pavel@labath.sk> |
ErrorTest: Break up "ErrorMatchers" test
This test was getting a bit long. Before adding more checks, group the existing checks according to the matcher used, and break it up into smaller tests.
|
Revision tags: llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1 |
|
#
ecb310b3 |
| 17-Oct-2019 |
Don Hinton <hintonda@gmail.com> |
[Error] Make llvm::cantFail include the original error messages
Summary: The current implementation eats the current errors and just outputs the message parameter passed to llvm::cantFail. This cha
[Error] Make llvm::cantFail include the original error messages
Summary: The current implementation eats the current errors and just outputs the message parameter passed to llvm::cantFail. This change appends the original error message(s), so the user can see exactly why cantFail failed. New logic is conditional on NDEBUG.
Reviewed By: lhames
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69057
llvm-svn: 375176
show more ...
|
Revision tags: llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3 |
|
#
0d802a49 |
| 14-Aug-2019 |
Pavel Labath <pavel@labath.sk> |
Revert "raw_ostream: add operator<< overload for std::error_code"
This reverts commit r368849, because it breaks some bots (e.g. llvm-clang-x86_64-win-fast).
It turns out this is not as NFC as we h
Revert "raw_ostream: add operator<< overload for std::error_code"
This reverts commit r368849, because it breaks some bots (e.g. llvm-clang-x86_64-win-fast).
It turns out this is not as NFC as we had hoped, because operator== will consider two std::error_codes to be distinct even though they both hold "success" values if they have different categories.
llvm-svn: 368854
show more ...
|