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

Static analysis flagged this since we could move MergedRanges since it is a 
std::vector, a local and unused after that line. So there is a potential saving.

>From b427ae1ef18c48126a0faf5f40678cc6e4e30634 Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour <shafik.yaghm...@intel.com>
Date: Wed, 4 Jun 2025 13:42:45 -0700
Subject: [PATCH] [Clang][NFC] Use move in std::vector local in
 HandleTranslationUnit

Static analysis flagged this since we could move MergedRanges since it is a
std::vector, a local and unused after that line. So there is a potential saving.
---
 clang/lib/Frontend/FrontendAction.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Frontend/FrontendAction.cpp 
b/clang/lib/Frontend/FrontendAction.cpp
index af9d18ab66108..ef7ae27a2694a 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -181,7 +181,7 @@ class DeserializedDeclsSourceRangePrinter : public 
ASTConsumer,
         if (MergedRanges.back().second < It->second)
           MergedRanges.back().second = It->second;
       }
-      Result.push_back({Data.Ref->getName(), MergedRanges});
+      Result.push_back({Data.Ref->getName(), std::move(MergedRanges)});
     }
     printJson(Result);
   }

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to