[PATCH] D58612: Use std::atomic<> for static counters.

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 25 05:52:28 PST 2019

riccibruno added a comment.

In D58612#1408836 <https://reviews.llvm.org/D58612#1408836>, @ilya-biryukov wrote:

> In D58612#1408831 <https://reviews.llvm.org/D58612#1408831>, @riccibruno wrote:
> > Hmm. These are not the only static variables which are used for statistics (eg: in `DeclBase.cpp`). Would it make sense instead to keep all of the statistics in the AST context (without making them atomic) ?
> +1, the only reason to use atomics here instead is if getting hold of an actual `ASTContext` is hard where the statistics are used (for legacy reasons?).

I don't know how hard it would be to do this, but I would like to argue that this should be done even if it require some refactoring. These static variables used for stats are kind of ugly imho; they conceptually belong to the AST context.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list