Clean up the logic of the Archive::Child::Child() with an assert to know Err is not...
authorKevin Enderby <enderby@apple.com>
Thu, 4 Aug 2016 21:54:19 +0000 (21:54 +0000)
committerKevin Enderby <enderby@apple.com>
Thu, 4 Aug 2016 21:54:19 +0000 (21:54 +0000)
commit2c182700752920eb1952846e10fd79ecfbfbbf3b
tree86085aced2ee6bc577456bc88129cf5720b885b2
parent61c16142b4d52b0e62db1e39d21093a56cd5f886
Clean up the logic of the Archive::Child::Child() with an assert to know Err is not a nullptr
when we are pointed at real data.

David Blaikie pointed out some odd logic in the case the Err value was a nullptr and
Lang Hames suggested it could be cleaned it up with an assert to know that Err is
not a nullptr when we are pointed at real data.  As only in the case of constructing
the sentinel value by pointing it at null data is Err is permitted to be a nullptr,
since no error could occur in that case.

With this change the testing for “if (Err)” is removed from the constructor’s logic
and *Err is used directly without any check after the assert().

llvm-svn: 277776
llvm/lib/Object/Archive.cpp