Skip to content

[Clang][NFC] Move Input into SmallVector instead of copy #143830

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

Merged
merged 1 commit into from
Jun 12, 2025

Conversation

shafik
Copy link
Collaborator

@shafik shafik commented Jun 12, 2025

Static analysis flagged Input as a large object that would benefit from being moved over being copied.

Static analysis flagged Input as a large object that would benefit from being
moved over being copied.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jun 12, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 12, 2025

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

Changes

Static analysis flagged Input as a large object that would benefit from being moved over being copied.


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

1 Files Affected:

  • (modified) clang/lib/Frontend/CompilerInstance.cpp (+1-1)
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 587b0d1af9c8d..09a66b652518f 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1191,7 +1191,7 @@ std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompileImpl(
   FrontendOpts.OriginalModuleMap = std::string(OriginalModuleMapFile);
   // Force implicitly-built modules to hash the content of the module file.
   HSOpts.ModulesHashContent = true;
-  FrontendOpts.Inputs = {Input};
+  FrontendOpts.Inputs = {std::move(Input)};
 
   // Don't free the remapped file buffers; they are owned by our caller.
   PPOpts.RetainRemappedFileBuffers = true;

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shafik shafik merged commit e4c32a4 into llvm:main Jun 12, 2025
9 checks passed
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
Static analysis flagged Input as a large object that would benefit from
being moved over being copied.
@shafik shafik deleted the cloneForModuleCompileImplMovInput branch June 15, 2025 05:28
akuhlens pushed a commit to akuhlens/llvm-project that referenced this pull request Jun 24, 2025
Static analysis flagged Input as a large object that would benefit from
being moved over being copied.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants