summaryrefslogtreecommitdiff
path: root/runtime/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/utils.h')
-rw-r--r--runtime/utils.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/utils.h b/runtime/utils.h
index 2389ce77fc..f3284e8304 100644
--- a/runtime/utils.h
+++ b/runtime/utils.h
@@ -279,6 +279,13 @@ int ExecAndReturnCode(std::vector<std::string>& arg_vector, std::string* error_m
bool FileExists(const std::string& filename);
bool FileExistsAndNotEmpty(const std::string& filename);
+// Returns `filename` with the text after the last occurrence of '.' replaced with
+// `extension`. If `filename` does not contain a period, returns a string containing `filename`,
+// a period, and `new_extension`.
+// Example: ReplaceFileExtension("foo.bar", "abc") == "foo.abc"
+// ReplaceFileExtension("foo", "abc") == "foo.abc"
+std::string ReplaceFileExtension(const std::string& filename, const std::string& new_extension);
+
class VoidFunctor {
public:
template <typename A>
@@ -386,6 +393,16 @@ inline void FlushInstructionCache(char* begin, char* end) {
__builtin___clear_cache(begin, end);
}
+template <typename T>
+constexpr PointerSize ConvertToPointerSize(T any) {
+ if (any == 4 || any == 8) {
+ return static_cast<PointerSize>(any);
+ } else {
+ LOG(FATAL);
+ UNREACHABLE();
+ }
+}
+
} // namespace art
#endif // ART_RUNTIME_UTILS_H_