[PATCH] D102944: [Windows] Use TerminateProcess to exit without running destructors
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 22 13:51:15 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb4fd512c36ca: [Windows] Use TerminateProcess to exit without running destructors (authored by mstorsjo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102944/new/
https://reviews.llvm.org/D102944
Files:
llvm/include/llvm/Support/Process.h
llvm/lib/Support/Process.cpp
llvm/lib/Support/Unix/Process.inc
llvm/lib/Support/Windows/Process.inc
Index: llvm/lib/Support/Windows/Process.inc
===================================================================
--- llvm/lib/Support/Windows/Process.inc
+++ llvm/lib/Support/Windows/Process.inc
@@ -503,3 +503,9 @@
// Windows 8 is version 6.2, service pack 0.
return GetWindowsOSVersion() >= llvm::VersionTuple(6, 2, 0, 0);
}
+
+LLVM_ATTRIBUTE_NORETURN
+void Process::ExitNoCleanup(int RetCode) {
+ TerminateProcess(GetCurrentProcess(), RetCode);
+ llvm_unreachable("TerminateProcess doesn't return");
+}
Index: llvm/lib/Support/Unix/Process.inc
===================================================================
--- llvm/lib/Support/Unix/Process.inc
+++ llvm/lib/Support/Unix/Process.inc
@@ -460,3 +460,6 @@
return ::rand();
#endif
}
+
+LLVM_ATTRIBUTE_NORETURN
+void Process::ExitNoCleanup(int RetCode) { _Exit(RetCode); }
Index: llvm/lib/Support/Process.cpp
===================================================================
--- llvm/lib/Support/Process.cpp
+++ llvm/lib/Support/Process.cpp
@@ -98,7 +98,7 @@
CRC->HandleExit(RetCode);
if (NoCleanup)
- _Exit(RetCode);
+ ExitNoCleanup(RetCode);
else
::exit(RetCode);
}
Index: llvm/include/llvm/Support/Process.h
===================================================================
--- llvm/include/llvm/Support/Process.h
+++ llvm/include/llvm/Support/Process.h
@@ -216,6 +216,10 @@
/// Use \arg NoCleanup for calling _exit() instead of exit().
LLVM_ATTRIBUTE_NORETURN
static void Exit(int RetCode, bool NoCleanup = false);
+
+private:
+ LLVM_ATTRIBUTE_NORETURN
+ static void ExitNoCleanup(int RetCode);
};
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102944.347215.patch
Type: text/x-patch
Size: 1613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210522/681fee92/attachment.bin>
More information about the llvm-commits
mailing list