[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
Mon May 25 03:42:30 PDT 2020


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

> here is what I think is going on:

@rnk , actually I've observed some another case:

- In **CommandLine.h** some amount of arbitrary `static cl::opt` is registered while constructing in `ManagedStatic<SubCommand> TopLevelSubCommand `, that is lazy-creates an instance of `ManagedStatic<SubCommand>::Ptr` at first call
- Then `ManagedStatic<SubCommand> TopLevelSubCommand` is actually constructed as a regular global variable, because its turn has come, thus re-init its members, particularly lost the list of previously registered `cl::opt`.



================
Comment at: llvm/include/llvm/Support/ManagedStatic.h:46
+// Check MSVC version here
+// (https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?redirectedfrom=MSDN&view=vs-2019).
+#if !defined(_MSC_VER) || (_MSC_VER >= 1925) || defined(__clang__)
----------------
rnk wrote:
> RKSimon wrote:
> > I'm not sure what the style rules are about exceeding the column-80 limit for URLs. Maybe just refer people to http://llvm.org/PR41367 ?
> I agree with @RKSimon, this comment seems like too much detail. The original comment already explains why the code is written the way it is. The only new information is that "affected versions" are now known to be `_MSC_VER < 1925`, which is clearly expressed by the code. I think you can remove the comment edits. Whenever we drop support for pre-1925 versions of MSVC, someone will come back here and remove all this. The VS dev community links are also probably not super stable.
> 
> Re: URLs in comments, yes, they generally are the most common exception to the line limit style rule, but I don't think they add much value in this case.
>Maybe just refer people to http://llvm.org/PR41367 ?
>this comment seems like too much detail. 
Make sense. I'll refer to PR41367. Thanks.


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

https://reviews.llvm.org/D80433





More information about the llvm-commits mailing list