diff options
| author | Lang Hames <lhames@gmail.com> | 2015-05-20 23:44:37 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2015-05-20 23:44:37 +0000 |
| commit | b103c0321f46deb31f82ea4e7069d1f5e521c0fc (patch) | |
| tree | 31868a6a6f2b0000c43b1779e5923ca0016bcf35 | |
| parent | cbab79a4f8853bd796bf6b90de48e64a5728e8c0 (diff) | |
| download | bcm5719-llvm-b103c0321f46deb31f82ea4e7069d1f5e521c0fc.tar.gz bcm5719-llvm-b103c0321f46deb31f82ea4e7069d1f5e521c0fc.zip | |
[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
| -rw-r--r-- | lld/include/lld/Core/Simple.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lld/include/lld/Core/Simple.h b/lld/include/lld/Core/Simple.h index c7482b213de..e88043abd3a 100644 --- a/lld/include/lld/Core/Simple.h +++ b/lld/include/lld/Core/Simple.h @@ -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()); } |

