[clang-tools-extra] 2954d1f - [include-cleaner] Fix -Wpessimizing-move in IncludeCleaner.cpp (NFC)

Jie Fu via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 03:52:32 PDT 2024


Author: Jie Fu
Date: 2024-10-17T18:51:40+08:00
New Revision: 2954d1f7bc8fa77c51768855d9df98f5559a5c5e

URL: https://github.com/llvm/llvm-project/commit/2954d1f7bc8fa77c51768855d9df98f5559a5c5e
DIFF: https://github.com/llvm/llvm-project/commit/2954d1f7bc8fa77c51768855d9df98f5559a5c5e.diff

LOG: [include-cleaner] Fix -Wpessimizing-move in IncludeCleaner.cpp (NFC)

/llvm-project/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp:302:14:
error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
      return std::move(llvm::errorCodeToError(Err));
             ^
/llvm-project/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp:302:14: note: remove std::move call here
      return std::move(llvm::errorCodeToError(Err));
             ^~~~~~~~~~                           ~
1 error generated.

Added: 
    

Modified: 
    clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
index 6bd9c40c70753c..f85dbc0e0c31f2 100644
--- a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -299,7 +299,7 @@ mapInputsToAbsPaths(clang::tooling::CompilationDatabase &CDB,
     if (auto Err = VFS->makeAbsolute(AbsPath)) {
       llvm::errs() << "Failed to get absolute path for " << Source << " : "
                    << Err.message() << '\n';
-      return std::move(llvm::errorCodeToError(Err));
+      return llvm::errorCodeToError(Err);
     }
     std::vector<clang::tooling::CompileCommand> Cmds =
         CDB.getCompileCommands(AbsPath);


        


More information about the cfe-commits mailing list