[PATCH] D30707: Fix C2712 build error on Windows
Konstantin Zhuravlyov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 7 12:21:46 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297192: Fix C2712 build error on Windows (authored by kzhuravl).
Changed prior to commit:
https://reviews.llvm.org/D30707?vs=90892&id=90909#toc
Repository:
rL LLVM
https://reviews.llvm.org/D30707
Files:
llvm/trunk/lib/Support/Windows/Threading.inc
Index: llvm/trunk/lib/Support/Windows/Threading.inc
===================================================================
--- llvm/trunk/lib/Support/Windows/Threading.inc
+++ llvm/trunk/lib/Support/Windows/Threading.inc
@@ -61,11 +61,8 @@
uint32_t llvm::get_max_thread_name_length() { return 0; }
-void llvm::set_thread_name(const Twine &Name) {
#if defined(_MSC_VER)
- // Make sure the input is null terminated.
- SmallString<64> Storage;
- StringRef NameStr = Name.toNullTerminatedStringRef(Storage);
+static void SetThreadName(DWORD Id, LPCSTR Name) {
constexpr DWORD MS_VC_EXCEPTION = 0x406D1388;
#pragma pack(push, 8)
@@ -79,16 +76,25 @@
THREADNAME_INFO info;
info.dwType = 0x1000;
- info.szName = NameStr.data();
- info.dwThreadId = ::GetCurrentThreadId();
+ info.szName = Name;
+ info.dwThreadId = Id;
info.dwFlags = 0;
__try {
::RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR),
(ULONG_PTR *)&info);
}
__except (EXCEPTION_EXECUTE_HANDLER) {
}
+}
+#endif
+
+void llvm::set_thread_name(const Twine &Name) {
+#if defined(_MSC_VER)
+ // Make sure the input is null terminated.
+ SmallString<64> Storage;
+ StringRef NameStr = Name.toNullTerminatedStringRef(Storage);
+ SetThreadName(::GetCurrentThreadId(), NameStr.data());
#endif
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30707.90909.patch
Type: text/x-patch
Size: 1318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170307/fd1d17e3/attachment.bin>
More information about the llvm-commits
mailing list