Note, `DirIndex++` below is incorrect for DWARF 5, but it can be fixed
later after the file index is fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358251
91177308-0d34-0410-b5e6-
96231b3b80d8
// For FileNames with no directories a DirIndex of 0 is used.
DirIndex = 0;
} else {
- DirIndex = 0;
- for (unsigned End = MCDwarfDirs.size(); DirIndex < End; DirIndex++) {
- if (Directory == MCDwarfDirs[DirIndex])
- break;
- }
+ DirIndex = llvm::find(MCDwarfDirs, Directory) - MCDwarfDirs.begin();
if (DirIndex >= MCDwarfDirs.size())
MCDwarfDirs.push_back(Directory);
// The DirIndex is one based, as DirIndex of 0 is used for FileNames with