File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 2525// These two headers must be included last, and make sure shlobj is required
2626// after Windows.h to make sure it picks up our definition of _WIN32_WINNT
2727#include " llvm/Support/Windows/WindowsSupport.h"
28- #include < atlbase.h>
2928#include < shellapi.h>
3029#include < shlobj.h>
3130
@@ -1395,19 +1394,22 @@ std::error_code remove_directories(const Twine &path, bool IgnoreErrors) {
13951394 if (FAILED (HR))
13961395 break ;
13971396 auto Uninitialize = make_scope_exit ([] { CoUninitialize (); });
1398- CComPtr<IFileOperation> FileOp;
1399- HR = FileOp.CoCreateInstance (CLSID_FileOperation);
1397+ IFileOperation *FileOp = NULL ;
1398+ HR = CoCreateInstance (CLSID_FileOperation, NULL , CLSCTX_ALL,
1399+ IID_PPV_ARGS (&FileOp));
14001400 if (FAILED (HR))
14011401 break ;
1402+ auto FileOpRelease = make_scope_exit ([&FileOp] { FileOp->Release (); });
14021403 HR = FileOp->SetOperationFlags (FOF_NO_UI | FOFX_NOCOPYHOOKS);
14031404 if (FAILED (HR))
14041405 break ;
14051406 PIDLIST_ABSOLUTE PIDL = ILCreateFromPathW (Path16.data ());
14061407 auto FreePIDL = make_scope_exit ([&PIDL] { ILFree (PIDL); });
1407- CComPtr< IShellItem> ShItem;
1408+ IShellItem * ShItem = NULL ;
14081409 HR = SHCreateItemFromIDList (PIDL, IID_PPV_ARGS (&ShItem));
14091410 if (FAILED (HR))
14101411 break ;
1412+ auto ShItemRelease = make_scope_exit ([&ShItem] { ShItem->Release (); });
14111413 HR = FileOp->DeleteItem (ShItem, NULL );
14121414 if (FAILED (HR))
14131415 break ;
You can’t perform that action at this time.
0 commit comments