瀏覽代碼

cmCTestMultiProcessHandler: Avoid extra copy of test maps

Brad King 2 年之前
父節點
當前提交
7bca3f8c80

+ 4 - 4
Source/CTest/cmCTestMultiProcessHandler.cxx

@@ -83,11 +83,11 @@ cmCTestMultiProcessHandler::cmCTestMultiProcessHandler()
 cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler() = default;
 
 // Set the tests
-void cmCTestMultiProcessHandler::SetTests(TestMap& tests,
-                                          PropertiesMap& properties)
+void cmCTestMultiProcessHandler::SetTests(TestMap tests,
+                                          PropertiesMap properties)
 {
-  this->Tests = tests;
-  this->Properties = properties;
+  this->Tests = std::move(tests);
+  this->Properties = std::move(properties);
   this->Total = this->Tests.size();
   if (!this->CTest->GetShowOnly()) {
     this->ReadCostData();

+ 1 - 1
Source/CTest/cmCTestMultiProcessHandler.h

@@ -57,7 +57,7 @@ public:
   cmCTestMultiProcessHandler();
   virtual ~cmCTestMultiProcessHandler();
   // Set the tests
-  void SetTests(TestMap& tests, PropertiesMap& properties);
+  void SetTests(TestMap tests, PropertiesMap properties);
   // Set the max number of tests that can be run at the same time.
   void SetParallelLevel(size_t);
   void SetTestLoad(unsigned long load);

+ 1 - 1
Source/CTest/cmCTestTestHandler.cxx

@@ -1385,7 +1385,7 @@ bool cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
     properties[p.Index] = &p;
   }
   parallel->SetResourceSpecFile(this->ResourceSpecFile);
-  parallel->SetTests(tests, properties);
+  parallel->SetTests(std::move(tests), std::move(properties));
   parallel->SetPassFailVectors(&passed, &failed);
   this->TestResults.clear();
   parallel->SetTestResults(&this->TestResults);