Replace StringPiece with std::string_view.
This replaces the last few StringPiece uses and removes
the stringpiece.h.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 123750182
Change-Id: I1bb5d05df47319b6ca386db01e14ce048ae54daf
diff --git a/tools/art_verifier/art_verifier.cc b/tools/art_verifier/art_verifier.cc
index 0ef6c06..b4aa678 100644
--- a/tools/art_verifier/art_verifier.cc
+++ b/tools/art_verifier/art_verifier.cc
@@ -92,28 +92,32 @@
protected:
using Base = CmdlineArgs;
- ParseStatus ParseCustom(const StringPiece& option, std::string* error_msg) override {
+ ParseStatus ParseCustom(const char* raw_option,
+ size_t raw_option_length,
+ std::string* error_msg) override {
+ DCHECK_EQ(strlen(raw_option), raw_option_length);
{
- ParseStatus base_parse = Base::ParseCustom(option, error_msg);
+ ParseStatus base_parse = Base::ParseCustom(raw_option, raw_option_length, error_msg);
if (base_parse != kParseUnknownArgument) {
return base_parse;
}
}
- if (option.starts_with("--dex-file=")) {
- dex_filename_ = option.substr(strlen("--dex-file=")).data();
+ std::string_view option(raw_option, raw_option_length);
+ if (StartsWith(option, "--dex-file=")) {
+ dex_filename_ = raw_option + strlen("--dex-file=");
} else if (option == "--dex-file-verifier") {
dex_file_verifier_ = true;
} else if (option == "--verbose") {
method_verifier_verbose_ = true;
} else if (option == "--verbose-debug") {
method_verifier_verbose_debug_ = true;
- } else if (option.starts_with("--repetitions=")) {
+ } else if (StartsWith(option, "--repetitions=")) {
char* end;
- repetitions_ = strtoul(option.substr(strlen("--repetitions=")).data(), &end, 10);
- } else if (option.starts_with("--api-level=")) {
+ repetitions_ = strtoul(raw_option + strlen("--repetitions="), &end, 10);
+ } else if (StartsWith(option, "--api-level=")) {
char* end;
- api_level_ = strtoul(option.substr(strlen("--api-level=")).data(), &end, 10);
+ api_level_ = strtoul(raw_option + strlen("--api-level="), &end, 10);
} else {
return kParseUnknownArgument;
}