summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-06-16 18:47:40 (GMT)
committerBrad King <brad.king@kitware.com>2022-07-05 20:34:57 (GMT)
commit1ee5a4a548c62e5c382f3497be82aac36a99e485 (patch)
tree5a95ec119c06a3cac5c83edb5bc4548d929c89e6 /Source/CTest
parentfd3ed41109db9682bbdcb5e5d3249b6654322ca6 (diff)
downloadCMake-1ee5a4a548c62e5c382f3497be82aac36a99e485.zip
CMake-1ee5a4a548c62e5c382f3497be82aac36a99e485.tar.gz
CMake-1ee5a4a548c62e5c382f3497be82aac36a99e485.tar.bz2
cmArgumentParser: Avoid allocating copies of keyword strings
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestCoverageCommand.cxx5
-rw-r--r--Source/CTest/cmCTestCoverageCommand.h3
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx7
-rw-r--r--Source/CTest/cmCTestHandlerCommand.h4
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx7
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h4
-rw-r--r--Source/CTest/cmCTestUploadCommand.cxx3
-rw-r--r--Source/CTest/cmCTestUploadCommand.h3
8 files changed, 23 insertions, 13 deletions
diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx
index 7432d08..9351b0b 100644
--- a/Source/CTest/cmCTestCoverageCommand.cxx
+++ b/Source/CTest/cmCTestCoverageCommand.cxx
@@ -4,6 +4,7 @@
#include <set>
+#include <cm/string_view>
#include <cmext/algorithm>
#include <cmext/string_view>
@@ -19,10 +20,10 @@ void cmCTestCoverageCommand::BindArguments()
}
void cmCTestCoverageCommand::CheckArguments(
- std::vector<std::string> const& keywords)
+ std::vector<cm::string_view> const& keywords)
{
this->LabelsMentioned =
- !this->Labels.empty() || cm::contains(keywords, "LABELS");
+ !this->Labels.empty() || cm::contains(keywords, "LABELS"_s);
}
cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h
index 9344852..20bb1a8 100644
--- a/Source/CTest/cmCTestCoverageCommand.h
+++ b/Source/CTest/cmCTestCoverageCommand.h
@@ -9,6 +9,7 @@
#include <vector>
#include <cm/memory>
+#include <cm/string_view>
#include "cmCTestHandlerCommand.h"
#include "cmCommand.h"
@@ -41,7 +42,7 @@ public:
protected:
void BindArguments() override;
- void CheckArguments(std::vector<std::string> const& keywords) override;
+ void CheckArguments(std::vector<cm::string_view> const& keywords) override;
cmCTestGenericHandler* InitializeHandler() override;
bool LabelsMentioned;
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 5494d20..865e27b 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -7,6 +7,7 @@
#include <cstring>
#include <sstream>
+#include <cm/string_view>
#include <cmext/string_view>
#include "cmCTest.h"
@@ -81,8 +82,8 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
// Process input arguments.
std::vector<std::string> unparsedArguments;
- std::vector<std::string> keywordsMissingValue;
- std::vector<std::string> parsedKeywords;
+ std::vector<cm::string_view> keywordsMissingValue;
+ std::vector<cm::string_view> parsedKeywords;
this->Parse(args, &unparsedArguments, &keywordsMissingValue,
&parsedKeywords);
this->CheckArguments(keywordsMissingValue);
@@ -242,6 +243,6 @@ void cmCTestHandlerCommand::BindArguments()
this->Bind("SUBMIT_INDEX"_s, this->SubmitIndex);
}
-void cmCTestHandlerCommand::CheckArguments(std::vector<std::string> const&)
+void cmCTestHandlerCommand::CheckArguments(std::vector<cm::string_view> const&)
{
}
diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h
index 756952d..4869deb 100644
--- a/Source/CTest/cmCTestHandlerCommand.h
+++ b/Source/CTest/cmCTestHandlerCommand.h
@@ -7,6 +7,8 @@
#include <string>
#include <vector>
+#include <cm/string_view>
+
#include "cmArgumentParser.h"
#include "cmCTestCommand.h"
@@ -42,7 +44,7 @@ protected:
// Command argument handling.
virtual void BindArguments();
- virtual void CheckArguments(std::vector<std::string> const& keywords);
+ virtual void CheckArguments(std::vector<cm::string_view> const& keywords);
bool Append = false;
bool Quiet = false;
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index a2dc615..288d5b4 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -7,6 +7,7 @@
#include <utility>
#include <cm/memory>
+#include <cm/string_view>
#include <cm/vector>
#include <cmext/algorithm>
#include <cmext/string_view>
@@ -173,12 +174,12 @@ void cmCTestSubmitCommand::BindArguments()
}
void cmCTestSubmitCommand::CheckArguments(
- std::vector<std::string> const& keywords)
+ std::vector<cm::string_view> const& keywords)
{
this->PartsMentioned =
- !this->Parts.empty() || cm::contains(keywords, "PARTS");
+ !this->Parts.empty() || cm::contains(keywords, "PARTS"_s);
this->FilesMentioned =
- !this->Files.empty() || cm::contains(keywords, "FILES");
+ !this->Files.empty() || cm::contains(keywords, "FILES"_s);
cm::erase_if(this->Parts, [this](std::string const& arg) -> bool {
cmCTest::Part p = this->CTest->GetPartFromName(arg);
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index c5d11df..65f09c3 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include <cm/string_view>
+
#include "cmCTestHandlerCommand.h"
class cmCommand;
@@ -35,7 +37,7 @@ public:
protected:
void BindArguments() override;
- void CheckArguments(std::vector<std::string> const& keywords) override;
+ void CheckArguments(std::vector<cm::string_view> const& keywords) override;
cmCTestGenericHandler* InitializeHandler() override;
bool CDashUpload = false;
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
index f86ee0d..8289dad 100644
--- a/Source/CTest/cmCTestUploadCommand.cxx
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -5,6 +5,7 @@
#include <set>
#include <sstream>
+#include <cm/string_view>
#include <cm/vector>
#include <cmext/string_view>
@@ -21,7 +22,7 @@ void cmCTestUploadCommand::BindArguments()
this->Bind("CAPTURE_CMAKE_ERROR"_s, this->CaptureCMakeError);
}
-void cmCTestUploadCommand::CheckArguments(std::vector<std::string> const&)
+void cmCTestUploadCommand::CheckArguments(std::vector<cm::string_view> const&)
{
cm::erase_if(this->Files, [this](std::string const& arg) -> bool {
if (!cmSystemTools::FileExists(arg)) {
diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h
index fe155f6..0058c31 100644
--- a/Source/CTest/cmCTestUploadCommand.h
+++ b/Source/CTest/cmCTestUploadCommand.h
@@ -9,6 +9,7 @@
#include <vector>
#include <cm/memory>
+#include <cm/string_view>
#include "cmCTestHandlerCommand.h"
#include "cmCommand.h"
@@ -42,7 +43,7 @@ public:
protected:
void BindArguments() override;
- void CheckArguments(std::vector<std::string> const&) override;
+ void CheckArguments(std::vector<cm::string_view> const&) override;
cmCTestGenericHandler* InitializeHandler() override;
std::vector<std::string> Files;