mirror of
https://github.com/intel/llvm.git
synced 2026-02-08 08:57:43 +08:00
[LLD] Make lastOrdinal atomic to avoid race conditions.
No test case: We don't have a good way to test race conditions. llvm-svn: 237857
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "lld/Core/UndefinedAtom.h"
|
||||
#include "llvm/ADT/ilist.h"
|
||||
#include "llvm/ADT/ilist_node.h"
|
||||
#include <atomic>
|
||||
|
||||
namespace lld {
|
||||
|
||||
@@ -206,7 +207,7 @@ namespace lld {
|
||||
class SimpleDefinedAtom : public DefinedAtom {
|
||||
public:
|
||||
explicit SimpleDefinedAtom(const File &f) : _file(f) {
|
||||
static uint32_t lastOrdinal = 0;
|
||||
static std::atomic<uint32_t> lastOrdinal(0);
|
||||
_ordinal = lastOrdinal++;
|
||||
_references.setAllocator(&f.allocator());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user