summaryrefslogtreecommitdiffstats
path: root/tools/veridex
diff options
context:
space:
mode:
Diffstat (limited to 'tools/veridex')
-rw-r--r--tools/veridex/flow_analysis.cc8
-rw-r--r--tools/veridex/hidden_api.cc4
-rw-r--r--tools/veridex/resolver.cc18
-rw-r--r--tools/veridex/veridex.h11
4 files changed, 22 insertions, 19 deletions
diff --git a/tools/veridex/flow_analysis.cc b/tools/veridex/flow_analysis.cc
index 1fca7e1ae7..65f236325e 100644
--- a/tools/veridex/flow_analysis.cc
+++ b/tools/veridex/flow_analysis.cc
@@ -131,15 +131,15 @@ const RegisterValue& VeriFlowAnalysis::GetRegister(uint32_t dex_register) const
RegisterValue VeriFlowAnalysis::GetReturnType(uint32_t method_index) {
const DexFile& dex_file = resolver_->GetDexFile();
- const DexFile::MethodId& method_id = dex_file.GetMethodId(method_index);
- const DexFile::ProtoId& proto_id = dex_file.GetMethodPrototype(method_id);
+ const dex::MethodId& method_id = dex_file.GetMethodId(method_index);
+ const dex::ProtoId& proto_id = dex_file.GetMethodPrototype(method_id);
VeriClass* cls = resolver_->GetVeriClass(proto_id.return_type_idx_);
return RegisterValue(RegisterSource::kMethod, DexFileReference(&dex_file, method_index), cls);
}
RegisterValue VeriFlowAnalysis::GetFieldType(uint32_t field_index) {
const DexFile& dex_file = resolver_->GetDexFile();
- const DexFile::FieldId& field_id = dex_file.GetFieldId(field_index);
+ const dex::FieldId& field_id = dex_file.GetFieldId(field_index);
VeriClass* cls = resolver_->GetVeriClass(field_id.type_idx_);
return RegisterValue(RegisterSource::kField, DexFileReference(&dex_file, field_index), cls);
}
@@ -716,7 +716,7 @@ RegisterValue FlowAnalysisCollector::AnalyzeInvoke(const Instruction& instructio
RegisterValue obj = GetRegister(GetParameterAt(instruction, is_range, args, 0));
const VeriClass* cls = obj.GetType();
if (cls != nullptr && cls->GetClassDef() != nullptr) {
- const DexFile::ClassDef* def = cls->GetClassDef();
+ const dex::ClassDef* def = cls->GetClassDef();
return RegisterValue(
RegisterSource::kClass,
DexFileReference(&resolver_->GetDexFileOf(*cls), def->class_idx_.index_),
diff --git a/tools/veridex/hidden_api.cc b/tools/veridex/hidden_api.cc
index 6a04365a3a..2af7b50a73 100644
--- a/tools/veridex/hidden_api.cc
+++ b/tools/veridex/hidden_api.cc
@@ -78,7 +78,7 @@ void HiddenApi::AddSignatureToApiList(const std::string& signature, hiddenapi::A
std::string HiddenApi::GetApiMethodName(const DexFile& dex_file, uint32_t method_index) {
std::stringstream ss;
- const DexFile::MethodId& method_id = dex_file.GetMethodId(method_index);
+ const dex::MethodId& method_id = dex_file.GetMethodId(method_index);
ss << dex_file.StringByTypeIdx(method_id.class_idx_)
<< "->"
<< dex_file.GetMethodName(method_id)
@@ -88,7 +88,7 @@ std::string HiddenApi::GetApiMethodName(const DexFile& dex_file, uint32_t method
std::string HiddenApi::GetApiFieldName(const DexFile& dex_file, uint32_t field_index) {
std::stringstream ss;
- const DexFile::FieldId& field_id = dex_file.GetFieldId(field_index);
+ const dex::FieldId& field_id = dex_file.GetFieldId(field_index);
ss << dex_file.StringByTypeIdx(field_id.class_idx_)
<< "->"
<< dex_file.GetFieldName(field_id)
diff --git a/tools/veridex/resolver.cc b/tools/veridex/resolver.cc
index 56729fffd0..0d769cda31 100644
--- a/tools/veridex/resolver.cc
+++ b/tools/veridex/resolver.cc
@@ -46,7 +46,7 @@ void VeridexResolver::Run() {
}
static bool HasSameNameAndSignature(const DexFile& dex_file,
- const DexFile::MethodId& method_id,
+ const dex::MethodId& method_id,
const char* method_name,
const char* type) {
return strcmp(method_name, dex_file.GetMethodName(method_id)) == 0 &&
@@ -54,7 +54,7 @@ static bool HasSameNameAndSignature(const DexFile& dex_file,
}
static bool HasSameNameAndSignature(const DexFile& dex_file,
- const DexFile::MethodId& method_id,
+ const dex::MethodId& method_id,
const char* method_name,
const Signature& signature) {
return strcmp(method_name, dex_file.GetMethodName(method_id)) == 0 &&
@@ -62,7 +62,7 @@ static bool HasSameNameAndSignature(const DexFile& dex_file,
}
static bool HasSameNameAndType(const DexFile& dex_file,
- const DexFile::FieldId& field_id,
+ const dex::FieldId& field_id,
const char* field_name,
const char* field_type) {
return strcmp(field_name, dex_file.GetFieldName(field_id)) == 0 &&
@@ -139,7 +139,7 @@ VeriMethod VeridexResolver::LookupMethodIn(const VeriClass& kls,
const DexFile& other_dex_file = resolver->dex_file_;
ClassAccessor other_dex_accessor(other_dex_file, *kls.GetClassDef());
for (const ClassAccessor::Method& method : other_dex_accessor.GetMethods()) {
- const DexFile::MethodId& other_method_id = other_dex_file.GetMethodId(method.GetIndex());
+ const dex::MethodId& other_method_id = other_dex_file.GetMethodId(method.GetIndex());
if (HasSameNameAndSignature(other_dex_file,
other_method_id,
method_name,
@@ -160,7 +160,7 @@ VeriMethod VeridexResolver::LookupMethodIn(const VeriClass& kls,
}
// Look at methods in `kls`'s interface hierarchy.
- const DexFile::TypeList* interfaces = other_dex_file.GetInterfacesList(*kls.GetClassDef());
+ const dex::TypeList* interfaces = other_dex_file.GetInterfacesList(*kls.GetClassDef());
if (interfaces != nullptr) {
for (size_t i = 0; i < interfaces->Size(); i++) {
dex::TypeIndex idx = interfaces->GetTypeItem(i).type_idx_;
@@ -194,7 +194,7 @@ VeriField VeridexResolver::LookupFieldIn(const VeriClass& kls,
const DexFile& other_dex_file = resolver->dex_file_;
ClassAccessor other_dex_accessor(other_dex_file, *kls.GetClassDef());
for (const ClassAccessor::Field& field : other_dex_accessor.GetFields()) {
- const DexFile::FieldId& other_field_id = other_dex_file.GetFieldId(field.GetIndex());
+ const dex::FieldId& other_field_id = other_dex_file.GetFieldId(field.GetIndex());
if (HasSameNameAndType(other_dex_file,
other_field_id,
field_name,
@@ -204,7 +204,7 @@ VeriField VeridexResolver::LookupFieldIn(const VeriClass& kls,
}
// Look at fields in `kls`'s interface hierarchy.
- const DexFile::TypeList* interfaces = other_dex_file.GetInterfacesList(*kls.GetClassDef());
+ const dex::TypeList* interfaces = other_dex_file.GetInterfacesList(*kls.GetClassDef());
if (interfaces != nullptr) {
for (size_t i = 0; i < interfaces->Size(); i++) {
dex::TypeIndex idx = interfaces->GetTypeItem(i).type_idx_;
@@ -258,7 +258,7 @@ VeriMethod VeridexResolver::GetMethod(uint32_t method_index) {
VeriMethod method_info = method_infos_[method_index];
if (method_info == nullptr) {
// Method is defined in another dex file.
- const DexFile::MethodId& method_id = dex_file_.GetMethodId(method_index);
+ const dex::MethodId& method_id = dex_file_.GetMethodId(method_index);
VeriClass* kls = GetVeriClass(method_id.class_idx_);
if (kls == nullptr) {
return nullptr;
@@ -276,7 +276,7 @@ VeriField VeridexResolver::GetField(uint32_t field_index) {
VeriField field_info = field_infos_[field_index];
if (field_info == nullptr) {
// Field is defined in another dex file.
- const DexFile::FieldId& field_id = dex_file_.GetFieldId(field_index);
+ const dex::FieldId& field_id = dex_file_.GetFieldId(field_index);
VeriClass* kls = GetVeriClass(field_id.class_idx_);
if (kls == nullptr) {
return nullptr;
diff --git a/tools/veridex/veridex.h b/tools/veridex/veridex.h
index e0d82616ae..f02de96150 100644
--- a/tools/veridex/veridex.h
+++ b/tools/veridex/veridex.h
@@ -19,11 +19,14 @@
#include <map>
-#include "dex/dex_file.h"
#include "dex/primitive.h"
namespace art {
+namespace dex {
+struct ClassDef;
+} // namespace dex
+
static int gTargetSdkVersion = 1000; // Will be initialized after parsing options.
/**
@@ -45,7 +48,7 @@ using VeriMethod = const uint8_t*;
class VeriClass {
public:
VeriClass() = default;
- VeriClass(Primitive::Type k, uint8_t dims, const DexFile::ClassDef* cl)
+ VeriClass(Primitive::Type k, uint8_t dims, const dex::ClassDef* cl)
: kind_(k), dimensions_(dims), class_def_(cl) {}
bool IsUninitialized() const {
@@ -62,7 +65,7 @@ class VeriClass {
Primitive::Type GetKind() const { return kind_; }
uint8_t GetDimensions() const { return dimensions_; }
- const DexFile::ClassDef* GetClassDef() const { return class_def_; }
+ const dex::ClassDef* GetClassDef() const { return class_def_; }
static VeriClass* object_;
static VeriClass* class_;
@@ -92,7 +95,7 @@ class VeriClass {
private:
Primitive::Type kind_;
uint8_t dimensions_;
- const DexFile::ClassDef* class_def_;
+ const dex::ClassDef* class_def_;
};
inline bool IsGetMethod(VeriMethod method) {