summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-07-22 16:11:25 +0000
committerLang Hames <lhames@gmail.com>2016-07-22 16:11:25 +0000
commit5e51a2e31abac0d03f5a3056d368b7cd289beff1 (patch)
tree3cfa6d2a2ff799451243715a1d8eae75289e5dfe /llvm/unittests/Support
parent047149f7452ac3eeeff226683d7fb1d354fc36cf (diff)
downloadbcm5719-llvm-5e51a2e31abac0d03f5a3056d368b7cd289beff1.tar.gz
bcm5719-llvm-5e51a2e31abac0d03f5a3056d368b7cd289beff1.zip
[Support] Make ErrorAsOutParameter take an Error* rather than an Error&.
This allows ErrorAsOutParameter to work better with "optional" errors. For example, consider a function where for certain input values it is known that the function can't fail. This can now be written as: Result foo(Arg X, Error *Err) { ErrorAsOutParameter EAO(Err); if (<Error Condition>) { if (Err) *Err = <report error>; else llvm_unreachable("Unexpected failure!"); } } Rather than having to construct an ErrorAsOutParameter under every conditional where Err is known to be non-null. llvm-svn: 276430
Diffstat (limited to 'llvm/unittests/Support')
-rw-r--r--llvm/unittests/Support/ErrorTest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp
index 20509268374..3d2f2089cf7 100644
--- a/llvm/unittests/Support/ErrorTest.cpp
+++ b/llvm/unittests/Support/ErrorTest.cpp
@@ -109,7 +109,7 @@ TEST(Error, UncheckedSuccess) {
// ErrorAsOutParameter tester.
void errAsOutParamHelper(Error &Err) {
- ErrorAsOutParameter ErrAsOutParam(Err);
+ ErrorAsOutParameter ErrAsOutParam(&Err);
// Verify that checked flag is raised - assignment should not crash.
Err = Error::success();
// Raise the checked bit manually - caller should still have to test the
OpenPOWER on IntegriCloud