experimental: tolerate the existence of a __deref macro

Microsoft's SAL has a `__deref` macro which results in a compilation
failure when building the filesystem module on Windows.  Rename the
member function internally to avoid the conflict.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293449 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Saleem Abdulrasool 2017-01-30 00:15:47 +00:00
parent 286816274d
commit b35cd98bc1
2 changed files with 11 additions and 8 deletions

View File

@ -1924,7 +1924,7 @@ public:
const directory_entry& operator*() const {
_LIBCPP_ASSERT(__imp_, "The end iterator cannot be dereferenced");
return __deref();
return __dereference();
}
const directory_entry* operator->() const
@ -1949,11 +1949,14 @@ private:
// construct the dir_stream
_LIBCPP_FUNC_VIS
directory_iterator(const path&, error_code *, directory_options = directory_options::none);
directory_iterator(const path&, error_code *,
directory_options = directory_options::none);
_LIBCPP_FUNC_VIS
directory_iterator& __increment(error_code * __ec = nullptr);
_LIBCPP_FUNC_VIS
const directory_entry& __deref() const;
const directory_entry& __dereference() const;
private:
shared_ptr<__dir_stream> __imp_;
@ -2036,11 +2039,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
const directory_entry& operator*() const
{ return __deref(); }
{ return __dereference(); }
_LIBCPP_INLINE_VISIBILITY
const directory_entry* operator->() const
{ return &__deref(); }
{ return &__dereference(); }
recursive_directory_iterator& operator++()
{ return __increment(); }
@ -2079,7 +2082,7 @@ private:
error_code *__ec);
_LIBCPP_FUNC_VIS
const directory_entry& __deref() const;
const directory_entry& __dereference() const;
_LIBCPP_FUNC_VIS
bool __try_recursion(error_code* __ec);

View File

@ -136,7 +136,7 @@ directory_iterator& directory_iterator::__increment(error_code *ec)
}
directory_entry const& directory_iterator::__deref() const {
directory_entry const& directory_iterator::__dereference() const {
_LIBCPP_ASSERT(__imp_, "Attempting to dereference an invalid iterator");
return __imp_->__entry_;
}
@ -182,7 +182,7 @@ int recursive_directory_iterator::depth() const {
return __imp_->__stack_.size() - 1;
}
const directory_entry& recursive_directory_iterator::__deref() const {
const directory_entry& recursive_directory_iterator::__dereference() const {
return __imp_->__stack_.top().__entry_;
}