[PATCH] D22079: Refactor Archive-child iteration.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 7 11:24:55 PDT 2016
lhames added inline comments.
Comment at: include/llvm/Object/Archive.h:110
@@ -110,1 +109,3 @@
+ Child C;
+ Error *E;
> Can this be "Error &"?
I tried that in my initial patch, but it interacts badly with end iterators: child_end() can't fail, but if you pass it an Error& you're essentially obliged (by Error's checking guarantees) to test the result. Then you're left asserting that an Error is in the non-error state, but because that assert isn't a "proper" error check (it'll go away in -Asserts builds) you also have to have to trigger a boolean conversion (e.g. (void)!!Err) and then explain why you did that. In the end it seemed saner to have two iterator states: Error attached (can increment, will report error) and No error attached (represents end, can't increment).
More information about the llvm-commits