[Lldb-commits] [lldb] 5bae3a0 - [lldb] Remove CompileUnit::SetSupportFiles overload (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 19 11:14:31 PDT 2023


Author: Jonas Devlieghere
Date: 2023-10-19T11:14:25-07:00
New Revision: 5bae3a0b0ccf8f4f2bcffc86453197f3cc5a9829

URL: https://github.com/llvm/llvm-project/commit/5bae3a0b0ccf8f4f2bcffc86453197f3cc5a9829
DIFF: https://github.com/llvm/llvm-project/commit/5bae3a0b0ccf8f4f2bcffc86453197f3cc5a9829.diff

LOG: [lldb] Remove CompileUnit::SetSupportFiles overload (NFC)

CompileUnit::SetSupportFiles had two overloads, one that took and lvalue
reference and one that takes an rvalue reference. This removes both and
replaces it with an overload that takes the FileSpecList by value and
moves it into the member variable.

Because we're storing the value as a member, this covers both cases. If
the new FileSpecList was passed by lvalue reference, we'd copy it into
the member anyway. If it was passed as an rvalue reference, we'll have
created a new instance using its move and then immediately move it again
into our member. In either case the number of copies remains unchanged.

Added: 
    

Modified: 
    lldb/include/lldb/Symbol/CompileUnit.h
    lldb/source/Symbol/CompileUnit.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Symbol/CompileUnit.h b/lldb/include/lldb/Symbol/CompileUnit.h
index 229ee2d27a703fd..93f191b49985847 100644
--- a/lldb/include/lldb/Symbol/CompileUnit.h
+++ b/lldb/include/lldb/Symbol/CompileUnit.h
@@ -331,8 +331,7 @@ class CompileUnit : public std::enable_shared_from_this<CompileUnit>,
   ///     A line table object pointer that this object now owns.
   void SetLineTable(LineTable *line_table);
 
-  void SetSupportFiles(const FileSpecList &support_files);
-  void SetSupportFiles(FileSpecList &&support_files);
+  void SetSupportFiles(FileSpecList support_files);
 
   void SetDebugMacros(const DebugMacrosSP &debug_macros);
 

diff  --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp
index 280425d5874b494..c9796973940a248 100644
--- a/lldb/source/Symbol/CompileUnit.cpp
+++ b/lldb/source/Symbol/CompileUnit.cpp
@@ -178,11 +178,7 @@ void CompileUnit::SetLineTable(LineTable *line_table) {
   m_line_table_up.reset(line_table);
 }
 
-void CompileUnit::SetSupportFiles(const FileSpecList &support_files) {
-  m_support_files = support_files;
-}
-
-void CompileUnit::SetSupportFiles(FileSpecList &&support_files) {
+void CompileUnit::SetSupportFiles(FileSpecList support_files) {
   m_support_files = std::move(support_files);
 }
 


        


More information about the lldb-commits mailing list