[lld] r226706 - Fix runtime error on Windows.
Rui Ueyama
ruiu at google.com
Wed Jan 21 14:16:17 PST 2015
Author: ruiu
Date: Wed Jan 21 16:16:17 2015
New Revision: 226706
URL: http://llvm.org/viewvc/llvm-project?rev=226706&view=rev
Log:
Fix runtime error on Windows.
I believe the original code is valid, but on Windows it failed with an
assertion error saying "Expression: vector iterator is not decrementable."
Don't use rbegin and rend to workaround that error.
Modified:
lld/trunk/lib/Core/Resolver.cpp
Modified: lld/trunk/lib/Core/Resolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Resolver.cpp?rev=226706&r1=226705&r2=226706&view=diff
==============================================================================
--- lld/trunk/lib/Core/Resolver.cpp (original)
+++ lld/trunk/lib/Core/Resolver.cpp Wed Jan 21 16:16:17 2015
@@ -276,8 +276,8 @@ File *Resolver::getFile(int &index) {
// Make a map of Symbol -> ArchiveFile.
void Resolver::makePreloadArchiveMap() {
std::vector<std::unique_ptr<Node>> &nodes = _context.getNodes();
- for (auto it = nodes.rbegin(), e = nodes.rend(); it != e; ++it)
- if (auto *fnode = dyn_cast<FileNode>(it->get()))
+ for (int i = nodes.size() - 1; i >= 0; --i)
+ if (auto *fnode = dyn_cast<FileNode>(nodes[i].get()))
if (auto *archive = dyn_cast<ArchiveLibraryFile>(fnode->getFile()))
for (StringRef sym : archive->getDefinedSymbols())
_archiveMap[sym] = archive;
More information about the llvm-commits
mailing list