[PATCH] D17778: TypedError for recoverable error handling
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 1 13:19:36 PST 2016
dblaikie added inline comments.
================
Comment at: unittests/Support/TypedErrorTest.cpp:247
@@ +246,3 @@
+
+ catchAllTypedErrors(
+ std::move(E),
----------------
Oh, right, one of the things I was going to suggest is to see if you could make this less indented - since it'll involve potetnially multiple lambdas like this. If the API looked like this instead, the clang-tidy indent would be much less:
Oh, maybe not. Seems there's a special case for a /single/ lambda, like this:
catchAllTypedErrors(std::move(E), [&](std::unique_ptr<CustomError> CE) {
...
});
But I can't seem to tickle that formatting to cascade into multiple such lambdas... /maybe/ worth talking to the clang-tidy folks to see if there's a formatting (eg: when any number of trailing arguments are lambdas, to format it like this:
catchAllTypedErrors(std::move(E), [&](std::unique_ptr<CustomSubError> SE) {
CustomErrorInfo2 = SE->getInfo();
CustomErrorExtraInfo = SE->getExtraInfo();
return TypedError();
}, [&](std::unique_ptr<CustomError> CE) {
// Assert that the CustomError instance above is handled before the
// CustomSubError - joinTypedErrors should preserve error ordering.
if (CustomErrorInfo2 != 0)
abort();
CustomErrorInfo1 = CE->getInfo();
return TypedError();
});
& we could try to figure out some way to not need the handleTypedError wrapper.. which might be nice even if we don't get the formatting improvement (less boilerplate is always a win)
Repository:
rL LLVM
http://reviews.llvm.org/D17778
More information about the llvm-commits
mailing list