summaryrefslogtreecommitdiff
path: root/include/llvm/Support/FileSystem.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Support/FileSystem.h')
-rw-r--r--include/llvm/Support/FileSystem.h19
1 files changed, 7 insertions, 12 deletions
diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h
index 586999794d50..ad21d8af66e9 100644
--- a/include/llvm/Support/FileSystem.h
+++ b/include/llvm/Support/FileSystem.h
@@ -27,7 +27,6 @@
#ifndef LLVM_SUPPORT_FILESYSTEM_H
#define LLVM_SUPPORT_FILESYSTEM_H
-#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
@@ -37,6 +36,7 @@
#include <cassert>
#include <cstdint>
#include <ctime>
+#include <memory>
#include <stack>
#include <string>
#include <system_error>
@@ -829,28 +829,23 @@ public:
};
namespace detail {
- /// RecDirIterState - Keeps state for the recursive_directory_iterator. It is
- /// reference counted in order to preserve InputIterator semantics on copy.
- struct RecDirIterState : public RefCountedBase<RecDirIterState> {
- RecDirIterState()
- : Level(0)
- , HasNoPushRequest(false) {}
-
+ /// Keeps state for the recursive_directory_iterator.
+ struct RecDirIterState {
std::stack<directory_iterator, std::vector<directory_iterator>> Stack;
- uint16_t Level;
- bool HasNoPushRequest;
+ uint16_t Level = 0;
+ bool HasNoPushRequest = false;
};
} // end namespace detail
/// recursive_directory_iterator - Same as directory_iterator except for it
/// recurses down into child directories.
class recursive_directory_iterator {
- IntrusiveRefCntPtr<detail::RecDirIterState> State;
+ std::shared_ptr<detail::RecDirIterState> State;
public:
recursive_directory_iterator() = default;
explicit recursive_directory_iterator(const Twine &path, std::error_code &ec)
- : State(new detail::RecDirIterState) {
+ : State(std::make_shared<detail::RecDirIterState>()) {
State->Stack.push(directory_iterator(path, ec));
if (State->Stack.top() == directory_iterator())
State.reset();