Fix bugs in recursive_directory_iterator implementation and tests.

There are two fixes in this patch:

* Fix bug where the constructor of recursive_directory_iterator did not reset
  the error code if no failure occurred.

* Fix tests were dependent on the iteration order of the test directories.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273060 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-06-17 22:22:37 +00:00
parent 40d9e09d89
commit 6f3b01af9c
3 changed files with 48 additions and 24 deletions

View File

@@ -165,6 +165,7 @@ recursive_directory_iterator::recursive_directory_iterator(const path& p,
directory_options opt, error_code *ec)
: __imp_(nullptr), __rec_(true)
{
if (ec) ec->clear();
std::error_code m_ec;
__dir_stream new_s(p, opt, m_ec);
if (m_ec) set_or_throw(m_ec, ec, "recursive_directory_iterator", p);
@@ -226,6 +227,8 @@ void recursive_directory_iterator::__advance(error_code* ec) {
__imp_.reset();
if (m_ec)
set_or_throw(m_ec, ec, "recursive_directory_iterator::operator++()");
else if (ec)
ec->clear();
}
bool recursive_directory_iterator::__try_recursion(error_code *ec) {