[llvm-branch-commits] [llvm] 28a6713 - [ManagedStatic] Fix build errors with clang-tblgen in Debug mode using MSVC 2019 v16.6

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 23 15:55:47 PDT 2020


Author: Denys Petrov
Date: 2020-06-23T15:55:12-07:00
New Revision: 28a6713e107c9f878cb6c59db8548bb732dcc79d

URL: https://github.com/llvm/llvm-project/commit/28a6713e107c9f878cb6c59db8548bb732dcc79d
DIFF: https://github.com/llvm/llvm-project/commit/28a6713e107c9f878cb6c59db8548bb732dcc79d.diff

LOG: [ManagedStatic] Fix build errors with clang-tblgen in Debug mode using MSVC 2019 v16.6

After updating MSVS19 from v16.4 to v16.6 I faced with a build errors compiling in Debug mode.
It complains on clang-tblgen.exe and llvm-tblgen.exe cmd line args.
VS compiler had a bug. It dynamically creates an object with constexpr ctor in Debug mode. This bug was fixed in VS2019 v16.5.
A workaround was implemented for that and everything works until v16.5 comes.
The workaround became irrelevant since v16.5 and caused build errors.
So I disabled the workaround for VS2019 v16.5 and higher.

This relates to http://llvm.org/PR41367.

Differential Revision: https://reviews.llvm.org/D80433

(cherry picked from commit 46e5c5fe778b92b2a7e2c2ad3610e1da6794bd5e)

Added: 
    

Modified: 
    llvm/include/llvm/Support/ManagedStatic.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/ManagedStatic.h b/llvm/include/llvm/Support/ManagedStatic.h
index bbd0d04ed040..f2b41422f131 100644
--- a/llvm/include/llvm/Support/ManagedStatic.h
+++ b/llvm/include/llvm/Support/ManagedStatic.h
@@ -40,8 +40,8 @@ template <typename T, size_t N> struct object_deleter<T[N]> {
 // constexpr, a dynamic initializer may be emitted depending on optimization
 // settings. For the affected versions of MSVC, use the old linker
 // initialization pattern of not providing a constructor and leaving the fields
-// uninitialized.
-#if !defined(_MSC_VER) || defined(__clang__)
+// uninitialized. See http://llvm.org/PR41367 for details.
+#if !defined(_MSC_VER) || (_MSC_VER >= 1925) || defined(__clang__)
 #define LLVM_USE_CONSTEXPR_CTOR
 #endif
 


        


More information about the llvm-branch-commits mailing list