summaryrefslogtreecommitdiff
path: root/libartbase/base/utils.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2019-02-06 17:38:26 +0000
committer Vladimir Marko <vmarko@google.com> 2019-02-07 12:29:35 +0000
commite512556ab85987c52e4be1fcd6d7a1d15a1b0fb6 (patch)
tree16e82b22829a269dcb7b8c305bb0a44c6f74c58e /libartbase/base/utils.h
parent2f34e59c10c30ea24fa5f4bc4e3d5a9dc6469c34 (diff)
Replace StringPiece with std::string_view in profman.
And in dexoptanalyzer and hiddenapi, see below. The parsing helpers in utils.h were mostly unused, only profman was calling one of them, so move that helper to profman and rewrite and fix it, remove the other helpers. This exposed dependency of dexoptanalyzer and hiddenapi on StringPiece indirectly included from utils.h, thus we replace it with std::string_view also in those tools. During the rewrite, avoid using std::string_view::data() as a null terminated string, prefer to fall back to the original null terminated raw option instead. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 123750182 Change-Id: Ibeec8069a5d82ea556e03e4577812f94dca6f387
Diffstat (limited to 'libartbase/base/utils.h')
-rw-r--r--libartbase/base/utils.h39
1 files changed, 0 insertions, 39 deletions
diff --git a/libartbase/base/utils.h b/libartbase/base/utils.h
index 11472a8017..9284950c1a 100644
--- a/libartbase/base/utils.h
+++ b/libartbase/base/utils.h
@@ -30,7 +30,6 @@
#include "enums.h"
#include "globals.h"
#include "macros.h"
-#include "stringpiece.h"
namespace art {
@@ -91,44 +90,6 @@ static inline const void* EntryPointToCodePointer(const void* entry_point) {
return reinterpret_cast<const void*>(code);
}
-using UsageFn = void (*)(const char*, ...);
-
-template <typename T>
-static void ParseIntOption(const StringPiece& option,
- const std::string& option_name,
- T* out,
- UsageFn usage,
- bool is_long_option = true) {
- std::string option_prefix = option_name + (is_long_option ? "=" : "");
- DCHECK(option.starts_with(option_prefix)) << option << " " << option_prefix;
- const char* value_string = option.substr(option_prefix.size()).data();
- int64_t parsed_integer_value = 0;
- if (!android::base::ParseInt(value_string, &parsed_integer_value)) {
- usage("Failed to parse %s '%s' as an integer", option_name.c_str(), value_string);
- }
- *out = dchecked_integral_cast<T>(parsed_integer_value);
-}
-
-template <typename T>
-static void ParseUintOption(const StringPiece& option,
- const std::string& option_name,
- T* out,
- UsageFn usage,
- bool is_long_option = true) {
- ParseIntOption(option, option_name, out, usage, is_long_option);
- if (*out < 0) {
- usage("%s passed a negative value %d", option_name.c_str(), *out);
- *out = 0;
- }
-}
-
-void ParseDouble(const std::string& option,
- char after_char,
- double min,
- double max,
- double* parsed_value,
- UsageFn Usage);
-
#if defined(__BIONIC__)
struct Arc4RandomGenerator {
typedef uint32_t result_type;