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

Denys Petrov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 22 09:05:50 PDT 2020


ASDenysPetrov marked an inline comment as done.
ASDenysPetrov added inline comments.


================
Comment at: llvm/include/llvm/Support/ManagedStatic.h:47
+// (https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?redirectedfrom=MSDN&view=vs-2019).
+#if (defined(_MSC_VER) && (_MSC_VER >= 1925)) || defined(__clang__)
 #define LLVM_USE_CONSTEXPR_CTOR
----------------
RKSimon wrote:
> aganea wrote:
> > ASDenysPetrov wrote:
> > > RKSimon wrote:
> > > > Won't this no longer fire on gcc builds? Maybe this:
> > > > ```
> > > > #if !defined(_MSC_VER) || defined(__clang__) || (defined(_MSC_VER) && (_MSC_VER >= 1925))
> > > > ```
> > > Thank you. I somehow missed this case.
> > > It'd be even better this:
> > > ```
> > > #if !defined(_MSC_VER) || (_MSC_VER >= 1925)
> > > ```
> > @ASDenysPetrov You need the `defined(__clang__)` part because users can set `_MSC_VER` with `-fmsc-version=` or through auto-detection (so you could have `_MSC_VER < 1925`), and yet that should use the `LLVM_USE_CONSTEXPR_CTOR` codepath.
> You need the clang case to support clang-cl builds.
> ```
> #if !defined(_MSC_VER) || (_MSC_VER >= 1925) || defined(__clang__)
> ```
OK. Thanks for clarification. I'll take this option:
```
#if !defined(_MSC_VER) || (_MSC_VER >= 1925) || defined(__clang__)
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80433/new/

https://reviews.llvm.org/D80433





More information about the llvm-commits mailing list