[PATCH] D53727: Only call FlushFileBuffers when writing executables

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 31 15:08:58 PDT 2018


rnk added inline comments.


================
Comment at: lib/Support/Windows/Path.inc:857-859
+static bool hasFlushBufferKernelBug() {
+  static llvm::VersionTuple ver = GetWindowsOSVersion();
+  static Optional<bool> HasBug{ver < llvm::VersionTuple(10, 0, 0, 17763)};
----------------
Rather than having two static locals which both emit guard variable initialization, I would recommend making a static local bool that simply is the return value.

You could probably do this:
  static bool Res = *(GetWindowsOSVersion() < llvm::VersionTuple(10, 0, 0, 17763));


================
Comment at: lib/Support/Windows/WindowsSupport.h:78-80
+inline llvm::VersionTuple GetWindowsOSVersion() {
+  HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll");
+  if (hMod) {
----------------
I was going to say, surely `GetVersionInfoEx` will give us this info, but now I see the mess that is versionhelpers.h, and I assume you tried that, and they don't expose the build number.


Repository:
  rL LLVM

https://reviews.llvm.org/D53727





More information about the llvm-commits mailing list