summaryrefslogtreecommitdiff
path: root/lib/Support/PathV2.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2011-12-12 06:03:33 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2011-12-12 06:03:33 +0000
commit1dd2ee7bf4d848e368829cb01033f297afb674ab (patch)
tree0458e46c4fee4ade88a676613bf80b4b76ed20f1 /lib/Support/PathV2.cpp
parent48b0bbf930f9efa72f46f70b7e81dec69c2397cc (diff)
downloadllvm-1dd2ee7bf4d848e368829cb01033f297afb674ab.tar.gz
llvm-1dd2ee7bf4d848e368829cb01033f297afb674ab.tar.bz2
llvm-1dd2ee7bf4d848e368829cb01033f297afb674ab.tar.xz
Support/Windows: Cleanup scoped handles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/PathV2.cpp')
-rw-r--r--lib/Support/PathV2.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Support/PathV2.cpp b/lib/Support/PathV2.cpp
index bebe442e24..0c145ab4f1 100644
--- a/lib/Support/PathV2.cpp
+++ b/lib/Support/PathV2.cpp
@@ -753,7 +753,9 @@ error_code remove_all_r(StringRef path, file_type ft, uint32_t &count) {
if (ft == file_type::directory_file) {
// This code would be a lot better with exceptions ;/.
error_code ec;
- for (directory_iterator i(path, ec), e; i != e; i.increment(ec)) {
+ directory_iterator i(path, ec);
+ if (ec) return ec;
+ for (directory_iterator e; i != e; i.increment(ec)) {
if (ec) return ec;
file_status st;
if (error_code ec = i->status(st)) return ec;