aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/VirtualFileSystem.cpp
diff options
context:
space:
mode:
authorGregory Alfonso <gfunni234@gmail.com>2023-09-27 13:39:30 -0700
committerFangrui Song <i@maskray.me>2023-09-27 13:39:30 -0700
commit40dc8e6889c055172dfa66823b3e0aa073240086 (patch)
tree4247811a3e9a19254e24f5669d73d205c7b41432 /llvm/lib/Support/VirtualFileSystem.cpp
parentab3e647b893e1063838a7aff5477c53338992558 (diff)
downloadllvm-40dc8e6889c055172dfa66823b3e0aa073240086.zip
llvm-40dc8e6889c055172dfa66823b3e0aa073240086.tar.gz
llvm-40dc8e6889c055172dfa66823b3e0aa073240086.tar.bz2
[NFC] Use const references to avoid copying objects in for-loops
Differential Revision: https://reviews.llvm.org/D139487
Diffstat (limited to 'llvm/lib/Support/VirtualFileSystem.cpp')
-rw-r--r--llvm/lib/Support/VirtualFileSystem.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp
index e361510..1f8563a 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -489,7 +489,7 @@ void OverlayFileSystem::printImpl(raw_ostream &OS, PrintType Type,
if (Type == PrintType::Contents)
Type = PrintType::Summary;
- for (auto FS : overlays_range())
+ for (const auto &FS : overlays_range())
FS->print(OS, Type, IndentLevel + 1);
}
@@ -552,7 +552,7 @@ class CombiningDirIterImpl : public llvm::vfs::detail::DirIterImpl {
public:
CombiningDirIterImpl(ArrayRef<FileSystemPtr> FileSystems, std::string Dir,
std::error_code &EC) {
- for (auto FS : FileSystems) {
+ for (const auto &FS : FileSystems) {
std::error_code FEC;
directory_iterator Iter = FS->dir_begin(Dir, FEC);
if (FEC && FEC != errc::no_such_file_or_directory) {