diff options
author | Fangrui Song <maskray@google.com> | 2019-04-12 04:55:10 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-04-12 04:55:10 +0000 |
commit | 2122957809b8568e86af6e46b85072682ec1a74b (patch) | |
tree | a0d962d04399f5f3f0fdffd622eaef899898ab5e | |
parent | 06bfe353febb3da09b43c740cda396b4ef84edef (diff) | |
download | bcm5719-llvm-2122957809b8568e86af6e46b85072682ec1a74b.tar.gz bcm5719-llvm-2122957809b8568e86af6e46b85072682ec1a74b.zip |
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
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index a95d97b70d9..262c520a06a 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 |