Skip to content

[clang-include-cleaner] Fix -Wpessimizing-move warning introduced in 4cda28c1ada702a08f6960eb4c93919187c1d4d1 #112684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

bc-lee
Copy link
Contributor

@bc-lee bc-lee commented Oct 17, 2024

@bc-lee
Copy link
Contributor Author

bc-lee commented Oct 17, 2024

Original PR: #111375

@llvmbot
Copy link
Member

llvmbot commented Oct 17, 2024

@llvm/pr-subscribers-clang-tools-extra

Author: Byoungchan Lee (bc-lee)

Changes

Failing log: https://lab.llvm.org/buildbot/#/builders/145/builds/2540


Full diff: https://github.com/llvm/llvm-project/pull/112684.diff

1 Files Affected:

  • (modified) clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp (+1-1)
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);

@mikaelholmen
Copy link
Collaborator

Already fixed in 2954d1f

    [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.

@bc-lee bc-lee closed this Oct 17, 2024
@bc-lee bc-lee deleted the feature/fix-pessimizing-move branch October 17, 2024 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants