forked from OSchip/llvm-project
Revert "Make COFF linker work when it's built by clang again."
This reverts commit r242006. The original issue in Clang was fixed in r242009, so we can now safely use std::atomic_flag. llvm-svn: 242112
This commit is contained in:
parent
326c2c4cff
commit
159fb4cd84
|
@ -71,6 +71,12 @@ std::error_code ArchiveFile::parse() {
|
|||
if (B->getName() != "__NULL_IMPORT_DESCRIPTOR")
|
||||
LazySymbols.push_back(B);
|
||||
}
|
||||
|
||||
// Seen is a map from member files to boolean values. Initially
|
||||
// all members are mapped to false, which indicates all these files
|
||||
// are not read yet.
|
||||
for (const Archive::Child &Child : File->children())
|
||||
Seen[Child.getBuffer().data()].clear();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
|
@ -84,8 +90,7 @@ ErrorOr<MemoryBufferRef> ArchiveFile::getMember(const Archive::Symbol *Sym) {
|
|||
|
||||
// Return an empty buffer if we have already returned the same buffer.
|
||||
const char *StartAddr = It->getBuffer().data();
|
||||
auto Pair = Seen.insert(StartAddr);
|
||||
if (!Pair.second)
|
||||
if (Seen[StartAddr].test_and_set())
|
||||
return MemoryBufferRef();
|
||||
return It->getMemoryBufferRef();
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ private:
|
|||
std::unique_ptr<Archive> File;
|
||||
std::string Filename;
|
||||
std::vector<Lazy *> LazySymbols;
|
||||
std::set<const char *> Seen;
|
||||
std::map<const char *, std::atomic_flag> Seen;
|
||||
llvm::MallocAllocator Alloc;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue