From e8da7cd1d0e7d3535c82f8d05adcef3edd43cd40 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 9 Apr 2024 12:49:48 +0000 Subject: Clean up string data access in `DexFile`. The `*ByIdx()` and `*ByTypeIdx()` functions were doing validity checks that were needed only for processing the debug data, so move the checks to these callers. Replace these functions with new overloads of other functions to provide consistent naming. In a few cases, rewrite calls to these functions to fetch and work with a `string_view` instead. Rename `GetStringLength()` to `GetStringUtf16Length()` and change its return type to `uint32_t`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I561899606f6e5ec5f23aa4be617349dacdb376e3 --- compiler/exception_test.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/exception_test.cc') diff --git a/compiler/exception_test.cc b/compiler/exception_test.cc index 3c7ff0a984..89fe56dda0 100644 --- a/compiler/exception_test.cc +++ b/compiler/exception_test.cc @@ -159,17 +159,17 @@ TEST_F(ExceptionTest, FindCatchHandler) { EXPECT_LE(t0.start_addr_, t1.start_addr_); { CatchHandlerIterator iter(accessor, 4 /* Dex PC in the first try block */); - EXPECT_STREQ("Ljava/io/IOException;", dex_->StringByTypeIdx(iter.GetHandlerTypeIndex())); + EXPECT_STREQ("Ljava/io/IOException;", dex_->GetTypeDescriptor(iter.GetHandlerTypeIndex())); ASSERT_TRUE(iter.HasNext()); iter.Next(); - EXPECT_STREQ("Ljava/lang/Exception;", dex_->StringByTypeIdx(iter.GetHandlerTypeIndex())); + EXPECT_STREQ("Ljava/lang/Exception;", dex_->GetTypeDescriptor(iter.GetHandlerTypeIndex())); ASSERT_TRUE(iter.HasNext()); iter.Next(); EXPECT_FALSE(iter.HasNext()); } { CatchHandlerIterator iter(accessor, 8 /* Dex PC in the second try block */); - EXPECT_STREQ("Ljava/io/IOException;", dex_->StringByTypeIdx(iter.GetHandlerTypeIndex())); + EXPECT_STREQ("Ljava/io/IOException;", dex_->GetTypeDescriptor(iter.GetHandlerTypeIndex())); ASSERT_TRUE(iter.HasNext()); iter.Next(); EXPECT_FALSE(iter.HasNext()); -- cgit v1.2.3-59-g8ed1b