mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 02:38:07 +08:00
[orc-rt] Add ErrorAsOutParameter convenience constructor. (#169467)
Allows construction of ErrorAsOutParameters from Error references.
This commit is contained in:
@@ -278,6 +278,8 @@ public:
|
||||
(void)!!*Err;
|
||||
}
|
||||
|
||||
ErrorAsOutParameter(Error &Err) : Err(&Err) { (void)!!Err; }
|
||||
|
||||
~ErrorAsOutParameter() {
|
||||
// Clear the checked bit.
|
||||
if (Err && !*Err)
|
||||
|
||||
@@ -257,6 +257,15 @@ TEST(ErrorTest, ErrorAsOutParameterUnchecked) {
|
||||
<< "ErrorAsOutParameter did not clear the checked flag on destruction.";
|
||||
}
|
||||
|
||||
// Test that we can construct an ErrorAsOutParameter from an Error&.
|
||||
TEST(ErrorTest, ErrorAsOutParameterRefConstructor) {
|
||||
Error E = Error::success();
|
||||
{
|
||||
ErrorAsOutParameter _(E); // construct with Error&.
|
||||
}
|
||||
(void)!!E;
|
||||
}
|
||||
|
||||
// Check 'Error::isA<T>' method handling.
|
||||
TEST(ErrorTest, IsAHandling) {
|
||||
// Check 'isA' handling.
|
||||
|
||||
Reference in New Issue
Block a user