summaryrefslogtreecommitdiff
path: root/tools/hiddenapi/hiddenapi.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2024-06-14 11:58:13 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2025-02-07 07:06:46 -0800
commitf850690a901c01d95210e3ecf66aa7255206aafc (patch)
tree98e871f5de2416109316eb25076380ed80638beb /tools/hiddenapi/hiddenapi.cc
parent08f1b58976bae5514a0d6877b4e8f68ff15bcafb (diff)
Use `ClassAccessor::GetViewDescriptor()` more.
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 338123769 Change-Id: Ib8206f037ece05374e16b8a3816520ea9bc70931
Diffstat (limited to 'tools/hiddenapi/hiddenapi.cc')
-rw-r--r--tools/hiddenapi/hiddenapi.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/hiddenapi/hiddenapi.cc b/tools/hiddenapi/hiddenapi.cc
index bc73865019..f5a8d58374 100644
--- a/tools/hiddenapi/hiddenapi.cc
+++ b/tools/hiddenapi/hiddenapi.cc
@@ -148,11 +148,11 @@ class DexClass : public ClassAccessor {
inline bool IsInterface() const { return HasAccessFlags(kAccInterface); }
inline bool Equals(const DexClass& other) const {
- bool equals = strcmp(GetDescriptor(), other.GetDescriptor()) == 0;
+ bool equals = GetDescriptorView() == other.GetDescriptorView();
if (equals) {
- LOG(FATAL) << "Class duplication: " << GetDescriptor() << " in " << dex_file_.GetLocation()
- << " and " << other.dex_file_.GetLocation();
+ LOG(FATAL) << "Class duplication: " << GetDescriptorView() << " in "
+ << dex_file_.GetLocation() << " and " << other.dex_file_.GetLocation();
}
return equals;
@@ -192,7 +192,7 @@ class DexMember {
// Constructs a string with a unique signature of this class member.
std::string GetApiEntry() const {
std::stringstream ss;
- ss << klass_.GetDescriptor() << "->" << GetName() << (IsMethod() ? "" : ":")
+ ss << klass_.GetDescriptorView() << "->" << GetName() << (IsMethod() ? "" : ":")
<< GetSignature();
return ss.str();
}
@@ -450,7 +450,7 @@ class Hierarchy final {
// Returns true if at least one resolvable member was found.
template<typename Fn>
bool ForEachResolvableMember(const DexMember& other, Fn fn) {
- HierarchyClass* klass = FindClass(other.GetDeclaringClass().GetDescriptor());
+ HierarchyClass* klass = FindClass(other.GetDeclaringClass().GetDescriptorView());
return (klass != nullptr) && klass->ForEachResolvableMember(other, fn);
}
@@ -473,7 +473,7 @@ class Hierarchy final {
// Example code (`foo` exposed by ClassB):
// class ClassA { public void foo() { ... } }
// public class ClassB extends ClassA {}
- HierarchyClass* klass = FindClass(member.GetDeclaringClass().GetDescriptor());
+ HierarchyClass* klass = FindClass(member.GetDeclaringClass().GetDescriptorView());
CHECK(klass != nullptr);
bool visible = false;
klass->ForEachSubClass([&visible, &member](HierarchyClass* subclass) {
@@ -497,7 +497,7 @@ class Hierarchy final {
}
private:
- HierarchyClass* FindClass(const std::string_view& descriptor) {
+ HierarchyClass* FindClass(std::string_view descriptor) {
auto it = classes_.find(descriptor);
if (it == classes_.end()) {
return nullptr;
@@ -510,7 +510,7 @@ class Hierarchy final {
// Create one HierarchyClass entry in `classes_` per class descriptor
// and add all DexClass objects with the same descriptor to that entry.
classpath_.ForEachDexClass([this](const DexClass& klass) {
- classes_[klass.GetDescriptor()].AddDexClass(klass);
+ classes_[klass.GetDescriptorView()].AddDexClass(klass);
});
// Connect each HierarchyClass to its successors and predecessors.
@@ -532,7 +532,7 @@ class Hierarchy final {
auto severity = verbose ? ::android::base::WARNING : ::android::base::FATAL;
LOG(severity)
<< "Superclass/interface " << extends_desc
- << " of class " << dex_klass.GetDescriptor() << " from dex file \""
+ << " of class " << dex_klass.GetDescriptorView() << " from dex file \""
<< dex_klass.GetDexFile().GetLocation() << "\" was not found. "
<< "Either it is missing or it appears later in the classpath spec.";
}