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

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 11 21:31:36 PDT 2025


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

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

>From ea85dd226ad4c8a6f9ef0a7f16c22fdc386c1334 Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour <shafik.yaghmour at intel.com>
Date: Wed, 11 Jun 2025 21:29:53 -0700
Subject: [PATCH] [Clang][NFC] Move Input into SmallVector instead of copy

Static analysis flagged Input as a large object that would benefit from being
moved over being copied.
---
 clang/lib/Frontend/CompilerInstance.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;



More information about the cfe-commits mailing list