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

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 25 08:44:30 PST 2019


alexfh added a comment.

> In D58612#1409024 <https://reviews.llvm.org/D58612#1409024>, @riccibruno wrote:
> 
>> ...
>>  For example in `DeclBase.cpp`
>>
>>   #define DECL(DERIVED, BASE) static int n##DERIVED##s = 0;
>>   #define ABSTRACT_DECL(DECL)
>>   #include "clang/AST/DeclNodes.inc"
>>
>>
>> ...
> 
> 
> These are probably easier to convert to std::atomic<int>, but I'd do this separately.

Just converting these to `std::atomic<>` will mute TSan, but won't fix the underlying issue: the stats should be collected per-compiler instance. Initialization will require a bit more locking as well. Not sure what would be a good solution here.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58612





More information about the cfe-commits mailing list