[clang] [Clang][NFC] Move Input into SmallVector instead of copy (PR #143830)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 11 21:32:06 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

<details>
<summary>Changes</summary>

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
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;

``````````

</details>


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


More information about the cfe-commits mailing list