summaryrefslogtreecommitdiffstats
path: root/runtime/dex_file-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/dex_file-inl.h')
-rw-r--r--runtime/dex_file-inl.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/dex_file-inl.h b/runtime/dex_file-inl.h
index dee8026..2ee9244 100644
--- a/runtime/dex_file-inl.h
+++ b/runtime/dex_file-inl.h
@@ -18,6 +18,7 @@
#define ART_RUNTIME_DEX_FILE_INL_H_
#include "base/logging.h"
+#include "base/stringpiece.h"
#include "dex_file.h"
#include "leb128.h"
#include "utils.h"
@@ -36,6 +37,16 @@ inline const char* DexFile::GetStringDataAndLength(const StringId& string_id, ui
return reinterpret_cast<const char*>(ptr);
}
+inline StringPiece DexFile::StringDataAsStringPieceByIdx(uint32_t idx) const {
+ if (idx == kDexNoIndex) {
+ return StringPiece();
+ }
+ const StringId& string_id = GetStringId(idx);
+ uint32_t length;
+ const char* data = GetStringDataAndLength(string_id, &length);
+ return StringPiece(data, static_cast<int>(length));
+}
+
inline const DexFile::TryItem* DexFile::GetTryItems(const CodeItem& code_item, uint32_t offset) {
const uint16_t* insns_end_ = &code_item.insns_[code_item.insns_size_in_code_units_];
return reinterpret_cast<const TryItem*>