From 40dc8e6889c055172dfa66823b3e0aa073240086 Mon Sep 17 00:00:00 2001 From: Gregory Alfonso Date: Wed, 27 Sep 2023 13:39:30 -0700 Subject: [NFC] Use const references to avoid copying objects in for-loops Differential Revision: https://reviews.llvm.org/D139487 --- llvm/lib/Support/VirtualFileSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Support/VirtualFileSystem.cpp') diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index e36151038b2d..1f8563ab82f4 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 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) { -- cgit v1.2.3