[llvm] 3e0d31c - [llvm-dis][NFC] Avoid unnecessary copies while iterating (#109860)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 07:40:03 PDT 2024


Author: Amr Hesham
Date: 2024-09-26T16:39:59+02:00
New Revision: 3e0d31c97cf27d46c464bf5a2712b28b69fa0503

URL: https://github.com/llvm/llvm-project/commit/3e0d31c97cf27d46c464bf5a2712b28b69fa0503
DIFF: https://github.com/llvm/llvm-project/commit/3e0d31c97cf27d46c464bf5a2712b28b69fa0503.diff

LOG: [llvm-dis][NFC] Avoid unnecessary copies while iterating (#109860)

Avoid unnecessary copies while iterating on input files

Added: 
    

Modified: 
    llvm/tools/llvm-dis/llvm-dis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-dis/llvm-dis.cpp b/llvm/tools/llvm-dis/llvm-dis.cpp
index a3a62f042ddbd1..744201289b4a42 100644
--- a/llvm/tools/llvm-dis/llvm-dis.cpp
+++ b/llvm/tools/llvm-dis/llvm-dis.cpp
@@ -203,7 +203,7 @@ int main(int argc, char **argv) {
     return 1;
   }
 
-  for (std::string InputFilename : InputFilenames) {
+  for (const auto &InputFilename : InputFilenames) {
     ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
         MemoryBuffer::getFileOrSTDIN(InputFilename);
     if (std::error_code EC = BufferOrErr.getError()) {


        


More information about the llvm-commits mailing list