Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions llvm/lib/Support/Windows/Path.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
// These two headers must be included last, and make sure shlobj is required
// after Windows.h to make sure it picks up our definition of _WIN32_WINNT
#include "llvm/Support/Windows/WindowsSupport.h"
#include <atlbase.h>
#include <shellapi.h>
#include <shlobj.h>

Expand Down Expand Up @@ -1395,19 +1394,22 @@ std::error_code remove_directories(const Twine &path, bool IgnoreErrors) {
if (FAILED(HR))
break;
auto Uninitialize = make_scope_exit([] { CoUninitialize(); });
CComPtr<IFileOperation> FileOp;
HR = FileOp.CoCreateInstance(CLSID_FileOperation);
IFileOperation *FileOp = NULL;
HR = CoCreateInstance(CLSID_FileOperation, NULL, CLSCTX_ALL,
IID_PPV_ARGS(&FileOp));
if (FAILED(HR))
break;
auto FileOpRelease = make_scope_exit([&FileOp] { FileOp->Release(); });
HR = FileOp->SetOperationFlags(FOF_NO_UI | FOFX_NOCOPYHOOKS);
if (FAILED(HR))
break;
PIDLIST_ABSOLUTE PIDL = ILCreateFromPathW(Path16.data());
auto FreePIDL = make_scope_exit([&PIDL] { ILFree(PIDL); });
CComPtr<IShellItem> ShItem;
IShellItem *ShItem = NULL;
HR = SHCreateItemFromIDList(PIDL, IID_PPV_ARGS(&ShItem));
if (FAILED(HR))
break;
auto ShItemRelease = make_scope_exit([&ShItem] { ShItem->Release(); });
HR = FileOp->DeleteItem(ShItem, NULL);
if (FAILED(HR))
break;
Expand Down
Loading