-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[llvm][Support][Windows] Refactored remove_directories() w/o CComPtr and atlbase.h #119843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…and atlbase.h This is the update of llvm#118677.
|
@llvm/pr-subscribers-llvm-support @llvm/pr-subscribers-platform-windows Author: Dmitry Vasilyev (slydiman) ChangesThis is the update of #118677. Full diff: https://github.com/llvm/llvm-project/pull/119843.diff 1 Files Affected:
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index d4e8261ae4feba..17db114caeb1ec 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -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>
@@ -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;
|
mstorsjo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much, LGTM, and thanks for the very quick fix!
It may be nice to explicitly mention it in the commit message, that this fixes building with mingw.
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/10263 Here is the relevant piece of the build log for the reference |
This is the update of #118677.