From 2122957809b8568e86af6e46b85072682ec1a74b Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 12 Apr 2019 04:55:10 +0000 Subject: MCDwarfLineTableheader::tryGetFile : replace a loop with llvm::find Note, `DirIndex++` below is incorrect for DWARF 5, but it can be fixed later after the file index is fixed. llvm-svn: 358251 --- llvm/lib/MC/MCDwarf.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'llvm/lib/MC/MCDwarf.cpp') diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index a95d97b..262c520 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -606,11 +606,7 @@ MCDwarfLineTableHeader::tryGetFile(StringRef &Directory, // 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 -- cgit v1.1