From 1dd2ee7bf4d848e368829cb01033f297afb674ab Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Mon, 12 Dec 2011 06:03:33 +0000 Subject: Support/Windows: Cleanup scoped handles. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146362 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/PathV2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/Support/PathV2.cpp') 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; -- cgit v1.2.3