From: Fangrui Song Date: Fri, 12 Apr 2019 04:55:10 +0000 (+0000) Subject: MCDwarfLineTableheader::tryGetFile : replace a loop with llvm::find X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77dd066466e0e9bd4965e06497891e42dab27597;p=llvm 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358251 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp index a95d97b70d9..262c520a06a 100644 --- a/lib/MC/MCDwarf.cpp +++ b/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