ART: Refactor for bugprone-argument-comment
Handles libartbase, libdexfile and libprofile.
Bug: 116054210
Test: WITH_TIDY=1 mmma art
Change-Id: Ibeee2446e2978af45402d9ca47c75ffc438de316
diff --git a/libartbase/base/bit_string_test.cc b/libartbase/base/bit_string_test.cc
index 89a71a1..45f4d4e 100644
--- a/libartbase/base/bit_string_test.cc
+++ b/libartbase/base/bit_string_test.cc
@@ -110,17 +110,17 @@
ASSERT_EQ(BitString::kCapacity, 3u);
EXPECT_BITSTRING_STR("BitString[]", bs);
- bs = SetBitStringCharAt(bs, /*i*/0, /*val*/1u);
+ bs = SetBitStringCharAt(bs, /*i=*/0, /*val=*/1u);
EXPECT_BITSTRING_STR("BitString[1]", bs);
- bs = SetBitStringCharAt(bs, /*i*/1, /*val*/2u);
+ bs = SetBitStringCharAt(bs, /*i=*/1, /*val=*/2u);
EXPECT_BITSTRING_STR("BitString[1,2]", bs);
- bs = SetBitStringCharAt(bs, /*i*/2, /*val*/3u);
+ bs = SetBitStringCharAt(bs, /*i=*/2, /*val=*/3u);
EXPECT_BITSTRING_STR("BitString[1,2,3]", bs);
// There should be at least "kCapacity" # of checks here, 1 for each unique position.
- EXPECT_EQ(MakeBitStringChar(/*idx*/0, /*val*/1u), bs[0]);
- EXPECT_EQ(MakeBitStringChar(/*idx*/1, /*val*/2u), bs[1]);
- EXPECT_EQ(MakeBitStringChar(/*idx*/2, /*val*/3u), bs[2]);
+ EXPECT_EQ(MakeBitStringChar(/*idx=*/0, /*val=*/1u), bs[0]);
+ EXPECT_EQ(MakeBitStringChar(/*idx=*/1, /*val=*/2u), bs[1]);
+ EXPECT_EQ(MakeBitStringChar(/*idx=*/2, /*val=*/3u), bs[2]);
// Each maximal value should be tested here for each position.
uint32_t max_bitstring_ints[] = {
diff --git a/libartbase/base/bit_struct_test.cc b/libartbase/base/bit_struct_test.cc
index 577682c..a2389eb 100644
--- a/libartbase/base/bit_struct_test.cc
+++ b/libartbase/base/bit_struct_test.cc
@@ -73,7 +73,7 @@
TEST(BitStructs, Custom) {
CustomBitStruct expected(0b1111);
- BitStructField<CustomBitStruct, /*lsb*/4, /*width*/4> f{};
+ BitStructField<CustomBitStruct, /*lsb=*/4, /*width=*/4> f{};
EXPECT_EQ(1u, sizeof(f));
@@ -85,9 +85,9 @@
EXPECT_EQ(AsUint(f), 0b11110000u);
}
-BITSTRUCT_DEFINE_START(TestTwoCustom, /* size */ 8)
- BitStructField<CustomBitStruct, /*lsb*/0, /*width*/4> f4_a;
- BitStructField<CustomBitStruct, /*lsb*/4, /*width*/4> f4_b;
+BITSTRUCT_DEFINE_START(TestTwoCustom, /* size= */ 8)
+ BitStructField<CustomBitStruct, /*lsb=*/0, /*width=*/4> f4_a;
+ BitStructField<CustomBitStruct, /*lsb=*/4, /*width=*/4> f4_b;
BITSTRUCT_DEFINE_END(TestTwoCustom);
TEST(BitStructs, TwoCustom) {
@@ -122,7 +122,7 @@
}
TEST(BitStructs, Number) {
- BitStructNumber<uint16_t, /*lsb*/4, /*width*/4> bsn{};
+ BitStructNumber<uint16_t, /*lsb=*/4, /*width=*/4> bsn{};
EXPECT_EQ(2u, sizeof(bsn));
bsn = 0b1111;
@@ -135,20 +135,20 @@
EXPECT_EQ(AsUint(bsn), 0b11110000u);
}
-BITSTRUCT_DEFINE_START(TestBitStruct, /* size */ 8)
- BitStructInt</*lsb*/0, /*width*/3> i3;
- BitStructUint</*lsb*/3, /*width*/4> u4;
+BITSTRUCT_DEFINE_START(TestBitStruct, /* size= */ 8)
+ BitStructInt</*lsb=*/0, /*width=*/3> i3;
+ BitStructUint</*lsb=*/3, /*width=*/4> u4;
- BitStructUint</*lsb*/0, /*width*/7> alias_all;
+ BitStructUint</*lsb=*/0, /*width=*/7> alias_all;
BITSTRUCT_DEFINE_END(TestBitStruct);
TEST(BitStructs, Test1) {
{
// Check minimal size selection is correct.
- BitStructInt</*lsb*/0, /*width*/3> i3;
- BitStructUint</*lsb*/3, /*width*/4> u4;
+ BitStructInt</*lsb=*/0, /*width=*/3> i3;
+ BitStructUint</*lsb=*/3, /*width=*/4> u4;
- BitStructUint</*lsb*/0, /*width*/7> alias_all;
+ BitStructUint</*lsb=*/0, /*width=*/7> alias_all;
EXPECT_EQ(1u, sizeof(i3));
EXPECT_EQ(1u, sizeof(u4));
@@ -216,12 +216,12 @@
}
}
-BITSTRUCT_DEFINE_START(MixedSizeBitStruct, /* size */ 32)
- BitStructUint</*lsb*/0, /*width*/3> u3;
- BitStructUint</*lsb*/3, /*width*/10> u10;
- BitStructUint</*lsb*/13, /*width*/19> u19;
+BITSTRUCT_DEFINE_START(MixedSizeBitStruct, /* size= */ 32)
+ BitStructUint</*lsb=*/0, /*width=*/3> u3;
+ BitStructUint</*lsb=*/3, /*width=*/10> u10;
+ BitStructUint</*lsb=*/13, /*width=*/19> u19;
- BitStructUint</*lsb*/0, /*width*/32> alias_all;
+ BitStructUint</*lsb=*/0, /*width=*/32> alias_all;
BITSTRUCT_DEFINE_END(MixedSizeBitStruct);
// static_assert(sizeof(MixedSizeBitStruct) == sizeof(uint32_t), "TestBitStructs#MixedSize");
@@ -255,11 +255,11 @@
EXPECT_EQ(0b10101010101010101011111010100111u, AsUint(tst));
}
-BITSTRUCT_DEFINE_START(TestBitStruct_u8, /* size */ 8)
- BitStructInt</*lsb*/0, /*width*/3> i3;
- BitStructUint</*lsb*/3, /*width*/4> u4;
+BITSTRUCT_DEFINE_START(TestBitStruct_u8, /* size= */ 8)
+ BitStructInt</*lsb=*/0, /*width=*/3> i3;
+ BitStructUint</*lsb=*/3, /*width=*/4> u4;
- BitStructUint</*lsb*/0, /*width*/8> alias_all;
+ BitStructUint</*lsb=*/0, /*width=*/8> alias_all;
BITSTRUCT_DEFINE_END(TestBitStruct_u8);
TEST(BitStructs, FieldAssignment) {
@@ -283,11 +283,11 @@
}
}
-BITSTRUCT_DEFINE_START(NestedStruct, /* size */ 64)
- BitStructField<MixedSizeBitStruct, /*lsb*/0> mixed_lower;
- BitStructField<MixedSizeBitStruct, /*lsb*/32> mixed_upper;
+BITSTRUCT_DEFINE_START(NestedStruct, /* size= */ 64)
+ BitStructField<MixedSizeBitStruct, /*lsb=*/0> mixed_lower;
+ BitStructField<MixedSizeBitStruct, /*lsb=*/32> mixed_upper;
- BitStructUint</*lsb*/0, /*width*/64> alias_all;
+ BitStructUint</*lsb=*/0, /*width=*/64> alias_all;
BITSTRUCT_DEFINE_END(NestedStruct);
TEST(BitStructs, NestedFieldAssignment) {
diff --git a/libartbase/base/bit_utils_test.cc b/libartbase/base/bit_utils_test.cc
index 3a80600..91fc3b0 100644
--- a/libartbase/base/bit_utils_test.cc
+++ b/libartbase/base/bit_utils_test.cc
@@ -353,89 +353,92 @@
static_assert(MaskLeastSignificant<uint64_t>(63) == (std::numeric_limits<uint64_t>::max() >> 1u),
"TestMaskLeastSignificant#6");
-static_assert(BitFieldClear(0xFF, /*lsb*/0, /*width*/0) == 0xFF, "TestBitFieldClear#1");
-static_assert(BitFieldClear(std::numeric_limits<uint32_t>::max(), /*lsb*/0, /*width*/32) == 0x0,
+static_assert(BitFieldClear(0xFF, /*lsb=*/0, /*width=*/0) == 0xFF, "TestBitFieldClear#1");
+static_assert(BitFieldClear(std::numeric_limits<uint32_t>::max(), /*lsb=*/0, /*width=*/32) == 0x0,
"TestBitFieldClear#2");
-static_assert(BitFieldClear(std::numeric_limits<int32_t>::max(), /*lsb*/0, /*width*/32) == 0x0,
+static_assert(BitFieldClear(std::numeric_limits<int32_t>::max(), /*lsb=*/0, /*width=*/32) == 0x0,
"TestBitFieldClear#3");
-static_assert(BitFieldClear(0xFF, /*lsb*/0, /*width*/2) == 0b11111100, "TestBitFieldClear#4");
-static_assert(BitFieldClear(0xFF, /*lsb*/0, /*width*/3) == 0b11111000, "TestBitFieldClear#5");
-static_assert(BitFieldClear(0xFF, /*lsb*/1, /*width*/3) == 0b11110001, "TestBitFieldClear#6");
-static_assert(BitFieldClear(0xFF, /*lsb*/2, /*width*/3) == 0b11100011, "TestBitFieldClear#7");
+static_assert(BitFieldClear(0xFF, /*lsb=*/0, /*width=*/2) == 0b11111100, "TestBitFieldClear#4");
+static_assert(BitFieldClear(0xFF, /*lsb=*/0, /*width=*/3) == 0b11111000, "TestBitFieldClear#5");
+static_assert(BitFieldClear(0xFF, /*lsb=*/1, /*width=*/3) == 0b11110001, "TestBitFieldClear#6");
+static_assert(BitFieldClear(0xFF, /*lsb=*/2, /*width=*/3) == 0b11100011, "TestBitFieldClear#7");
-static_assert(BitFieldExtract(0xFF, /*lsb*/0, /*width*/0) == 0x0, "TestBitFieldExtract#1");
-static_assert(BitFieldExtract(std::numeric_limits<uint32_t>::max(), /*lsb*/0, /*width*/32)
+static_assert(BitFieldExtract(0xFF, /*lsb=*/0, /*width=*/0) == 0x0, "TestBitFieldExtract#1");
+static_assert(BitFieldExtract(std::numeric_limits<uint32_t>::max(), /*lsb=*/0, /*width=*/32)
== std::numeric_limits<uint32_t>::max(),
"TestBitFieldExtract#2");
-static_assert(BitFieldExtract(std::numeric_limits<int32_t>::max(), /*lsb*/0, /*width*/32)
+static_assert(BitFieldExtract(std::numeric_limits<int32_t>::max(), /*lsb=*/0, /*width=*/32)
== std::numeric_limits<int32_t>::max(),
"TestBitFieldExtract#3");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/0, /*width*/2) == 0b00000011,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/0, /*width=*/2) == 0b00000011,
"TestBitFieldExtract#4");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/0, /*width*/3) == 0b00000111,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/0, /*width=*/3) == 0b00000111,
"TestBitFieldExtract#5");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/1, /*width*/3) == 0b00000111,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/1, /*width=*/3) == 0b00000111,
"TestBitFieldExtract#6");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/2, /*width*/3) == 0b00000111,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/2, /*width=*/3) == 0b00000111,
"TestBitFieldExtract#7");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/3, /*width*/3) == 0b00000111,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/3, /*width=*/3) == 0b00000111,
"TestBitFieldExtract#8");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/8, /*width*/3) == 0b00000000,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/8, /*width=*/3) == 0b00000000,
"TestBitFieldExtract#9");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/7, /*width*/3) == 0b00000001,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/7, /*width=*/3) == 0b00000001,
"TestBitFieldExtract#10");
-static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb*/6, /*width*/3) == 0b00000011,
+static_assert(BitFieldExtract(static_cast<uint32_t>(0xFF), /*lsb=*/6, /*width=*/3) == 0b00000011,
"TestBitFieldExtract#11");
-static_assert(BitFieldExtract(0xFF, /*lsb*/0, /*width*/2) == -1, "TestBitFieldExtract#12");
-static_assert(BitFieldExtract(0xFF, /*lsb*/0, /*width*/3) == -1, "TestBitFieldExtract#13");
-static_assert(BitFieldExtract(0xFF, /*lsb*/1, /*width*/3) == -1, "TestBitFieldExtract#14");
-static_assert(BitFieldExtract(0xFF, /*lsb*/2, /*width*/3) == -1, "TestBitFieldExtract#15");
-static_assert(BitFieldExtract(0xFF, /*lsb*/3, /*width*/3) == -1, "TestBitFieldExtract#16");
-static_assert(BitFieldExtract(0xFF, /*lsb*/8, /*width*/3) == 0b00000000, "TestBitFieldExtract#17");
-static_assert(BitFieldExtract(0xFF, /*lsb*/7, /*width*/3) == 0b00000001, "TestBitFieldExtract#18");
-static_assert(BitFieldExtract(0xFF, /*lsb*/6, /*width*/3) == 0b00000011, "TestBitFieldExtract#19");
-static_assert(BitFieldExtract(static_cast<uint8_t>(0b01101010), /*lsb*/2, /*width*/4)
+static_assert(BitFieldExtract(0xFF, /*lsb=*/0, /*width=*/2) == -1, "TestBitFieldExtract#12");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/0, /*width=*/3) == -1, "TestBitFieldExtract#13");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/1, /*width=*/3) == -1, "TestBitFieldExtract#14");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/2, /*width=*/3) == -1, "TestBitFieldExtract#15");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/3, /*width=*/3) == -1, "TestBitFieldExtract#16");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/8, /*width=*/3) == 0b00000000,
+ "TestBitFieldExtract#17");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/7, /*width=*/3) == 0b00000001,
+ "TestBitFieldExtract#18");
+static_assert(BitFieldExtract(0xFF, /*lsb=*/6, /*width=*/3) == 0b00000011,
+ "TestBitFieldExtract#19");
+static_assert(BitFieldExtract(static_cast<uint8_t>(0b01101010), /*lsb=*/2, /*width=*/4)
== 0b00001010,
"TestBitFieldExtract#20");
-static_assert(BitFieldExtract(static_cast<int8_t>(0b01101010), /*lsb*/2, /*width*/4)
+static_assert(BitFieldExtract(static_cast<int8_t>(0b01101010), /*lsb=*/2, /*width=*/4)
== static_cast<int8_t>(0b11111010),
"TestBitFieldExtract#21");
-static_assert(BitFieldInsert(0xFF, /*data*/0x0, /*lsb*/0, /*width*/0) == 0xFF,
+static_assert(BitFieldInsert(0xFF, /*data=*/0x0, /*lsb=*/0, /*width=*/0) == 0xFF,
"TestBitFieldInsert#1");
static_assert(BitFieldInsert(std::numeric_limits<uint32_t>::max(),
- /*data*/std::numeric_limits<uint32_t>::max(),
- /*lsb*/0,
- /*width*/32)
+ /*data=*/std::numeric_limits<uint32_t>::max(),
+ /*lsb=*/0,
+ /*width=*/32)
== std::numeric_limits<uint32_t>::max(),
"TestBitFieldInsert#2");
static_assert(BitFieldInsert(std::numeric_limits<int32_t>::max(),
- /*data*/std::numeric_limits<uint32_t>::max(),
- /*lsb*/0,
- /*width*/32)
+ /*data=*/std::numeric_limits<uint32_t>::max(),
+ /*lsb=*/0,
+ /*width=*/32)
== std::numeric_limits<uint32_t>::max(),
"TestBitFieldInsert#3");
static_assert(BitFieldInsert(0u,
- /*data*/std::numeric_limits<uint32_t>::max(),
- /*lsb*/0,
- /*width*/32)
+ /*data=*/std::numeric_limits<uint32_t>::max(),
+ /*lsb=*/0,
+ /*width=*/32)
== std::numeric_limits<uint32_t>::max(),
"TestBitFieldInsert#4");
static_assert(BitFieldInsert(-(-0),
- /*data*/std::numeric_limits<uint32_t>::max(),
- /*lsb*/0,
- /*width*/32)
+ /*data=*/std::numeric_limits<uint32_t>::max(),
+ /*lsb=*/0,
+ /*width=*/32)
== std::numeric_limits<uint32_t>::max(),
"TestBitFieldInsert#5");
-static_assert(BitFieldInsert(0x00, /*data*/0b11u, /*lsb*/0, /*width*/2) == 0b00000011,
+static_assert(BitFieldInsert(0x00, /*data=*/0b11u, /*lsb=*/0, /*width=*/2) == 0b00000011,
"TestBitFieldInsert#6");
-static_assert(BitFieldInsert(0x00, /*data*/0b111u, /*lsb*/0, /*width*/3) == 0b00000111,
+static_assert(BitFieldInsert(0x00, /*data=*/0b111u, /*lsb=*/0, /*width=*/3) == 0b00000111,
"TestBitFieldInsert#7");
-static_assert(BitFieldInsert(0x00, /*data*/0b111u, /*lsb*/1, /*width*/3) == 0b00001110,
+static_assert(BitFieldInsert(0x00, /*data=*/0b111u, /*lsb=*/1, /*width=*/3) == 0b00001110,
"TestBitFieldInsert#8");
-static_assert(BitFieldInsert(0x00, /*data*/0b111u, /*lsb*/2, /*width*/3) == 0b00011100,
+static_assert(BitFieldInsert(0x00, /*data=*/0b111u, /*lsb=*/2, /*width=*/3) == 0b00011100,
"TestBitFieldInsert#9");
-static_assert(BitFieldInsert(0b01011100, /*data*/0b1101u, /*lsb*/4, /*width*/4) == 0b11011100,
+static_assert(BitFieldInsert(0b01011100, /*data=*/0b1101u, /*lsb=*/4, /*width=*/4) == 0b11011100,
"TestBitFieldInsert#10");
template <typename Container>
diff --git a/libartbase/base/common_art_test.cc b/libartbase/base/common_art_test.cc
index b65710b..9485fca 100644
--- a/libartbase/base/common_art_test.cc
+++ b/libartbase/base/common_art_test.cc
@@ -251,7 +251,7 @@
static constexpr bool kVerifyChecksum = true;
const ArtDexFileLoader dex_file_loader;
if (!dex_file_loader.Open(
- location, location, /* verify */ true, kVerifyChecksum, &error_msg, &dex_files)) {
+ location, location, /* verify= */ true, kVerifyChecksum, &error_msg, &dex_files)) {
LOG(FATAL) << "Could not open .dex file '" << location << "': " << error_msg << "\n";
UNREACHABLE();
} else {
diff --git a/libartbase/base/file_magic.cc b/libartbase/base/file_magic.cc
index d8d843b..1471c59 100644
--- a/libartbase/base/file_magic.cc
+++ b/libartbase/base/file_magic.cc
@@ -31,7 +31,7 @@
File OpenAndReadMagic(const char* filename, uint32_t* magic, std::string* error_msg) {
CHECK(magic != nullptr);
- File fd(filename, O_RDONLY, /* check_usage */ false);
+ File fd(filename, O_RDONLY, /* check_usage= */ false);
if (fd.Fd() == -1) {
*error_msg = StringPrintf("Unable to open '%s' : %s", filename, strerror(errno));
return File();
diff --git a/libartbase/base/file_utils_test.cc b/libartbase/base/file_utils_test.cc
index 2a7273b..f7c9c5e 100644
--- a/libartbase/base/file_utils_test.cc
+++ b/libartbase/base/file_utils_test.cc
@@ -71,12 +71,12 @@
// Set ANDROID_ROOT to something else (but the directory must exist). So use dirname.
UniqueCPtr<char> root_dup(strdup(android_root_env.c_str()));
char* dir = dirname(root_dup.get());
- ASSERT_EQ(0, setenv("ANDROID_ROOT", dir, 1 /* overwrite */));
+ ASSERT_EQ(0, setenv("ANDROID_ROOT", dir, /* overwrite */ 1));
std::string android_root2 = GetAndroidRootSafe(&error_msg);
EXPECT_STREQ(dir, android_root2.c_str());
// Set a bogus value for ANDROID_ROOT. This should be an error.
- ASSERT_EQ(0, setenv("ANDROID_ROOT", "/this/is/obviously/bogus", 1 /* overwrite */));
+ ASSERT_EQ(0, setenv("ANDROID_ROOT", "/this/is/obviously/bogus", /* overwrite */ 1));
EXPECT_EQ(GetAndroidRootSafe(&error_msg), "");
// Unset ANDROID_ROOT and see that it still returns something (as libart code is running).
@@ -90,7 +90,7 @@
// Reset ANDROID_ROOT, as other things may depend on it.
- ASSERT_EQ(0, setenv("ANDROID_ROOT", android_root_env.c_str(), 1 /* overwrite */));
+ ASSERT_EQ(0, setenv("ANDROID_ROOT", android_root_env.c_str(), /* overwrite */ 1));
}
TEST_F(FileUtilsTest, ReplaceFileExtension) {
diff --git a/libartbase/base/mem_map.cc b/libartbase/base/mem_map.cc
index 06a168d..532ca28 100644
--- a/libartbase/base/mem_map.cc
+++ b/libartbase/base/mem_map.cc
@@ -394,7 +394,7 @@
return Invalid();
}
const size_t page_aligned_byte_count = RoundUp(byte_count, kPageSize);
- return MemMap(name, addr, byte_count, addr, page_aligned_byte_count, 0, true /* reuse */);
+ return MemMap(name, addr, byte_count, addr, page_aligned_byte_count, 0, /* reuse= */ true);
}
template<typename A, typename B>
@@ -696,8 +696,8 @@
tail_name,
tail_prot,
MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS,
- /* fd */ -1,
- /* offset */ 0,
+ /* fd= */ -1,
+ /* offset= */ 0,
error_msg,
use_debug_name);
}
@@ -771,7 +771,7 @@
uint8_t* begin = Begin();
ReleaseReservedMemory(byte_count); // Performs necessary DCHECK()s on this reservation.
size_t base_size = RoundUp(byte_count, kPageSize);
- return MemMap(name_, begin, byte_count, begin, base_size, prot_, /* reuse */ false);
+ return MemMap(name_, begin, byte_count, begin, base_size, prot_, /* reuse= */ false);
}
void MemMap::ReleaseReservedMemory(size_t byte_count) {
diff --git a/libartbase/base/mem_map_test.cc b/libartbase/base/mem_map_test.cc
index bf143d4..5815cf9 100644
--- a/libartbase/base/mem_map_test.cc
+++ b/libartbase/base/mem_map_test.cc
@@ -53,7 +53,7 @@
// Find a valid map address and unmap it before returning.
std::string error_msg;
MemMap map = MemMap::MapAnonymous("temp",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
size,
PROT_READ,
low_4gb,
@@ -68,7 +68,7 @@
const size_t page_size = static_cast<size_t>(kPageSize);
// Map a two-page memory region.
MemMap m0 = MemMap::MapAnonymous("MemMapTest_RemapAtEndTest_map0",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
2 * page_size,
PROT_READ | PROT_WRITE,
low_4gb,
@@ -165,17 +165,17 @@
TEST_F(MemMapTest, ReplaceMapping_SameSize) {
std::string error_msg;
MemMap dest = MemMap::MapAnonymous("MapAnonymousEmpty-atomic-replace-dest",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(dest.IsValid());
MemMap source = MemMap::MapAnonymous("MapAnonymous-atomic-replace-source",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_WRITE | PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(source.IsValid());
void* source_addr = source.Begin();
@@ -200,21 +200,21 @@
TEST_F(MemMapTest, ReplaceMapping_MakeLarger) {
std::string error_msg;
MemMap dest = MemMap::MapAnonymous("MapAnonymousEmpty-atomic-replace-dest",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
5 * kPageSize, // Need to make it larger
// initially so we know
// there won't be mappings
// in the way we we move
// source.
PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(dest.IsValid());
MemMap source = MemMap::MapAnonymous("MapAnonymous-atomic-replace-source",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
3 * kPageSize,
PROT_WRITE | PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(source.IsValid());
uint8_t* source_addr = source.Begin();
@@ -246,17 +246,17 @@
TEST_F(MemMapTest, ReplaceMapping_MakeSmaller) {
std::string error_msg;
MemMap dest = MemMap::MapAnonymous("MapAnonymousEmpty-atomic-replace-dest",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
3 * kPageSize,
PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(dest.IsValid());
MemMap source = MemMap::MapAnonymous("MapAnonymous-atomic-replace-source",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_WRITE | PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(source.IsValid());
uint8_t* source_addr = source.Begin();
@@ -285,11 +285,11 @@
MemMap dest =
MemMap::MapAnonymous(
"MapAnonymousEmpty-atomic-replace-dest",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
3 * kPageSize, // Need to make it larger initially so we know there won't be mappings in
// the way we we move source.
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(dest.IsValid());
// Resize down to 1 page so we can remap the rest.
@@ -299,7 +299,7 @@
dest.Begin() + kPageSize,
2 * kPageSize,
PROT_WRITE | PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(source.IsValid());
ASSERT_EQ(dest.Begin() + kPageSize, source.Begin());
@@ -332,20 +332,20 @@
CommonInit();
std::string error_msg;
MemMap map = MemMap::MapAnonymous("MapAnonymousEmpty",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
0,
PROT_READ,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_FALSE(map.IsValid()) << error_msg;
ASSERT_FALSE(error_msg.empty());
error_msg.clear();
map = MemMap::MapAnonymous("MapAnonymousNonEmpty",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -358,7 +358,7 @@
reinterpret_cast<uint8_t*>(kPageSize),
0x20000,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
nullptr);
ASSERT_FALSE(map.IsValid());
}
@@ -368,20 +368,20 @@
CommonInit();
std::string error_msg;
MemMap map = MemMap::MapAnonymous("MapAnonymousEmpty",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
0,
PROT_READ,
- /* low_4gb */ true,
+ /* low_4gb= */ true,
&error_msg);
ASSERT_FALSE(map.IsValid()) << error_msg;
ASSERT_FALSE(error_msg.empty());
error_msg.clear();
map = MemMap::MapAnonymous("MapAnonymousNonEmpty",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ true,
+ /* low_4gb= */ true,
&error_msg);
ASSERT_TRUE(map.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -394,12 +394,12 @@
constexpr size_t kMapSize = kPageSize;
std::unique_ptr<uint8_t[]> data(new uint8_t[kMapSize]());
ASSERT_TRUE(scratch_file.GetFile()->WriteFully(&data[0], kMapSize));
- MemMap map = MemMap::MapFile(/*byte_count*/kMapSize,
+ MemMap map = MemMap::MapFile(/*byte_count=*/kMapSize,
PROT_READ,
MAP_PRIVATE,
scratch_file.GetFd(),
- /*start*/0,
- /*low_4gb*/true,
+ /*start=*/0,
+ /*low_4gb=*/true,
scratch_file.GetFilename().c_str(),
&error_msg);
ASSERT_TRUE(map.IsValid()) << error_msg;
@@ -413,23 +413,23 @@
CommonInit();
std::string error_msg;
// Find a valid address.
- uint8_t* valid_address = GetValidMapAddress(kPageSize, /*low_4gb*/false);
+ uint8_t* valid_address = GetValidMapAddress(kPageSize, /*low_4gb=*/false);
// Map at an address that should work, which should succeed.
MemMap map0 = MemMap::MapAnonymous("MapAnonymous0",
valid_address,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map0.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
ASSERT_TRUE(map0.BaseBegin() == valid_address);
// Map at an unspecified address, which should succeed.
MemMap map1 = MemMap::MapAnonymous("MapAnonymous1",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map1.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -439,7 +439,7 @@
reinterpret_cast<uint8_t*>(map1.BaseBegin()),
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_FALSE(map2.IsValid()) << error_msg;
ASSERT_TRUE(!error_msg.empty());
@@ -469,12 +469,12 @@
memset(&data[2 * kPageSize], 0xaa, kPageSize);
ASSERT_TRUE(scratch_file.GetFile()->WriteFully(&data[0], kMapSize));
- MemMap map = MemMap::MapFile(/*byte_count*/kMapSize,
+ MemMap map = MemMap::MapFile(/*byte_count=*/kMapSize,
PROT_READ,
MAP_PRIVATE,
scratch_file.GetFd(),
- /*start*/0,
- /*low_4gb*/true,
+ /*start=*/0,
+ /*low_4gb=*/true,
scratch_file.GetFilename().c_str(),
&error_msg);
ASSERT_TRUE(map.IsValid()) << error_msg;
@@ -522,7 +522,7 @@
reinterpret_cast<uint8_t*>(start_addr),
size,
PROT_READ | PROT_WRITE,
- /*low_4gb*/ true,
+ /*low_4gb=*/ true,
&error_msg);
if (map.IsValid()) {
break;
@@ -543,7 +543,7 @@
reinterpret_cast<uint8_t*>(ptr),
2 * kPageSize, // brings it over the top.
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_FALSE(map.IsValid());
ASSERT_FALSE(error_msg.empty());
@@ -558,7 +558,7 @@
reinterpret_cast<uint8_t*>(UINT64_C(0x100000000)),
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ true,
+ /* low_4gb= */ true,
&error_msg);
ASSERT_FALSE(map.IsValid());
ASSERT_FALSE(error_msg.empty());
@@ -571,7 +571,7 @@
reinterpret_cast<uint8_t*>(0xF0000000),
0x20000000,
PROT_READ | PROT_WRITE,
- /* low_4gb */ true,
+ /* low_4gb= */ true,
&error_msg);
ASSERT_FALSE(map.IsValid());
ASSERT_FALSE(error_msg.empty());
@@ -585,9 +585,9 @@
nullptr,
0x20000,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
- /* reuse */ false,
- /* reservation */ nullptr,
+ /* low_4gb= */ false,
+ /* reuse= */ false,
+ /* reservation= */ nullptr,
&error_msg);
ASSERT_TRUE(map.IsValid());
ASSERT_TRUE(error_msg.empty());
@@ -595,9 +595,9 @@
reinterpret_cast<uint8_t*>(map.BaseBegin()),
0x10000,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
- /* reuse */ true,
- /* reservation */ nullptr,
+ /* low_4gb= */ false,
+ /* reuse= */ true,
+ /* reservation= */ nullptr,
&error_msg);
ASSERT_TRUE(map2.IsValid());
ASSERT_TRUE(error_msg.empty());
@@ -609,10 +609,10 @@
constexpr size_t kNumPages = 3;
// Map a 3-page mem map.
MemMap map = MemMap::MapAnonymous("MapAnonymous0",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kPageSize * kNumPages,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -627,7 +627,7 @@
map_base,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map0.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -635,7 +635,7 @@
map_base + kPageSize,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map1.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -643,7 +643,7 @@
map_base + kPageSize * 2,
kPageSize,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(map2.IsValid()) << error_msg;
ASSERT_TRUE(error_msg.empty());
@@ -672,10 +672,10 @@
const size_t page_size = static_cast<size_t>(kPageSize);
// Map a region.
MemMap m0 = MemMap::MapAnonymous("MemMapTest_AlignByTest_map0",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
14 * page_size,
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(m0.IsValid());
uint8_t* base0 = m0.Begin();
@@ -778,10 +778,10 @@
ASSERT_TRUE(scratch_file.GetFile()->WriteFully(&data[0], kMapSize));
MemMap reservation = MemMap::MapAnonymous("Test reservation",
- /* addr */ nullptr,
+ /* addr= */ nullptr,
kMapSize,
PROT_NONE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
&error_msg);
ASSERT_TRUE(reservation.IsValid());
ASSERT_TRUE(error_msg.empty());
@@ -791,14 +791,14 @@
static_assert(kChunk1Size < kMapSize, "We want to split the reservation.");
uint8_t* addr1 = reservation.Begin();
MemMap map1 = MemMap::MapFileAtAddress(addr1,
- /* byte_count */ kChunk1Size,
+ /* byte_count= */ kChunk1Size,
PROT_READ,
MAP_PRIVATE,
scratch_file.GetFd(),
- /* start */ 0,
- /* low_4gb */ false,
+ /* start= */ 0,
+ /* low_4gb= */ false,
scratch_file.GetFilename().c_str(),
- /* reuse */ false,
+ /* reuse= */ false,
&reservation,
&error_msg);
ASSERT_TRUE(map1.IsValid()) << error_msg;
@@ -816,10 +816,10 @@
uint8_t* addr2 = reservation.Begin();
MemMap map2 = MemMap::MapAnonymous("MiddleReservation",
addr2,
- /* byte_count */ kChunk2Size,
+ /* byte_count= */ kChunk2Size,
PROT_READ,
- /* low_4gb */ false,
- /* reuse */ false,
+ /* low_4gb= */ false,
+ /* reuse= */ false,
&reservation,
&error_msg);
ASSERT_TRUE(map2.IsValid()) << error_msg;
@@ -833,14 +833,14 @@
const size_t kChunk3Size = reservation.Size() - 1u;
uint8_t* addr3 = reservation.Begin();
MemMap map3 = MemMap::MapFileAtAddress(addr3,
- /* byte_count */ kChunk3Size,
+ /* byte_count= */ kChunk3Size,
PROT_READ,
MAP_PRIVATE,
scratch_file.GetFd(),
- /* start */ dchecked_integral_cast<size_t>(addr3 - addr1),
- /* low_4gb */ false,
+ /* start= */ dchecked_integral_cast<size_t>(addr3 - addr1),
+ /* low_4gb= */ false,
scratch_file.GetFilename().c_str(),
- /* reuse */ false,
+ /* reuse= */ false,
&reservation,
&error_msg);
ASSERT_TRUE(map3.IsValid()) << error_msg;
diff --git a/libartbase/base/scoped_flock.cc b/libartbase/base/scoped_flock.cc
index d679328..beee501 100644
--- a/libartbase/base/scoped_flock.cc
+++ b/libartbase/base/scoped_flock.cc
@@ -40,7 +40,7 @@
// to acquire a lock, and the unlock / close in the corresponding
// destructor. Callers should explicitly flush files they're writing to if
// that is the desired behaviour.
- std::unique_ptr<File> file(OS::OpenFileWithFlags(filename, flags, false /* check_usage */));
+ std::unique_ptr<File> file(OS::OpenFileWithFlags(filename, flags, /* auto_flush= */ false));
if (file.get() == nullptr) {
*error_msg = StringPrintf("Failed to open file '%s': %s", filename, strerror(errno));
return nullptr;
@@ -98,7 +98,7 @@
// destructor. Callers should explicitly flush files they're writing to if
// that is the desired behaviour.
ScopedFlock locked_file(
- new LockedFile(dup(fd), path, false /* check_usage */, read_only_mode));
+ new LockedFile(dup(fd), path, /* check_usage= */ false, read_only_mode));
if (locked_file->Fd() == -1) {
*error_msg = StringPrintf("Failed to duplicate open file '%s': %s",
locked_file->GetPath().c_str(), strerror(errno));
diff --git a/libartbase/base/scoped_flock_test.cc b/libartbase/base/scoped_flock_test.cc
index f9ac1e0..22356cd 100644
--- a/libartbase/base/scoped_flock_test.cc
+++ b/libartbase/base/scoped_flock_test.cc
@@ -38,7 +38,7 @@
// Attempt to acquire a second lock on the same file. This must fail.
ScopedFlock second_lock = LockedFile::Open(scratch_file.GetFilename().c_str(),
O_RDONLY,
- /* block */ false,
+ /* block= */ false,
&error_msg);
ASSERT_TRUE(second_lock.get() == nullptr);
ASSERT_TRUE(!error_msg.empty());
diff --git a/libartbase/base/zip_archive.cc b/libartbase/base/zip_archive.cc
index 174d227..f5761cf 100644
--- a/libartbase/base/zip_archive.cc
+++ b/libartbase/base/zip_archive.cc
@@ -75,10 +75,10 @@
name += " extracted in memory from ";
name += zip_filename;
MemMap map = MemMap::MapAnonymous(name.c_str(),
- /* addr */ nullptr,
+ /* addr= */ nullptr,
GetUncompressedLength(),
PROT_READ | PROT_WRITE,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
error_msg);
if (!map.IsValid()) {
DCHECK(!error_msg->empty());
@@ -138,7 +138,7 @@
MAP_PRIVATE,
zip_fd,
offset,
- /* low_4gb */ false,
+ /* low_4gb= */ false,
name.c_str(),
error_msg);
diff --git a/libdexfile/dex/art_dex_file_loader.cc b/libdexfile/dex/art_dex_file_loader.cc
index 4f73967..20a519b 100644
--- a/libdexfile/dex/art_dex_file_loader.cc
+++ b/libdexfile/dex/art_dex_file_loader.cc
@@ -95,7 +95,7 @@
File fd;
if (zip_fd != -1) {
if (ReadMagicAndReset(zip_fd, &magic, error_msg)) {
- fd = File(DupCloexec(zip_fd), false /* check_usage */);
+ fd = File(DupCloexec(zip_fd), /* check_usage= */ false);
}
} else {
fd = OpenAndReadMagic(filename, &magic, error_msg);
@@ -142,9 +142,9 @@
if (IsMagicValid(magic)) {
std::unique_ptr<const DexFile> dex_file(OpenFile(fd.Release(),
filename,
- /* verify */ false,
- /* verify_checksum */ false,
- /* mmap_shared */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
+ /* mmap_shared= */ false,
error_msg));
if (dex_file == nullptr) {
return false;
@@ -167,16 +167,16 @@
ScopedTrace trace(std::string("Open dex file from RAM ") + location);
return OpenCommon(base,
size,
- /*data_base*/ nullptr,
- /*data_size*/ 0u,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0u,
location,
location_checksum,
oat_dex_file,
verify,
verify_checksum,
error_msg,
- /*container*/ nullptr,
- /*verify_result*/ nullptr);
+ /*container=*/ nullptr,
+ /*verify_result=*/ nullptr);
}
std::unique_ptr<const DexFile> ArtDexFileLoader::Open(const std::string& location,
@@ -199,8 +199,8 @@
uint8_t* begin = map.Begin();
std::unique_ptr<DexFile> dex_file = OpenCommon(begin,
size,
- /*data_base*/ nullptr,
- /*data_size*/ 0u,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0u,
location,
location_checksum,
kNoOatDexFile,
@@ -208,7 +208,7 @@
verify_checksum,
error_msg,
std::make_unique<MemMapContainer>(std::move(map)),
- /*verify_result*/ nullptr);
+ /*verify_result=*/ nullptr);
// Opening CompactDex is only supported from vdex files.
if (dex_file != nullptr && dex_file->IsCompactDexFile()) {
*error_msg = StringPrintf("Opening CompactDex file '%s' is only supported from vdex files",
@@ -240,7 +240,7 @@
location,
verify,
verify_checksum,
- /* mmap_shared */ false,
+ /* mmap_shared= */ false,
error_msg));
if (dex_file.get() != nullptr) {
dex_files->push_back(std::move(dex_file));
@@ -290,7 +290,7 @@
CHECK(!location.empty());
MemMap map;
{
- File delayed_close(fd, /* check_usage */ false);
+ File delayed_close(fd, /* check_usage= */ false);
struct stat sbuf;
memset(&sbuf, 0, sizeof(sbuf));
if (fstat(fd, &sbuf) == -1) {
@@ -308,7 +308,7 @@
mmap_shared ? MAP_SHARED : MAP_PRIVATE,
fd,
0,
- /*low_4gb*/false,
+ /*low_4gb=*/false,
location.c_str(),
error_msg);
if (!map.IsValid()) {
@@ -330,8 +330,8 @@
std::unique_ptr<DexFile> dex_file = OpenCommon(begin,
size,
- /*data_base*/ nullptr,
- /*data_size*/ 0u,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0u,
location,
dex_header->checksum_,
kNoOatDexFile,
@@ -339,7 +339,7 @@
verify_checksum,
error_msg,
std::make_unique<MemMapContainer>(std::move(map)),
- /*verify_result*/ nullptr);
+ /*verify_result=*/ nullptr);
// Opening CompactDex is only supported from vdex files.
if (dex_file != nullptr && dex_file->IsCompactDexFile()) {
@@ -407,8 +407,8 @@
size_t size = map.Size();
std::unique_ptr<DexFile> dex_file = OpenCommon(begin,
size,
- /*data_base*/ nullptr,
- /*data_size*/ 0u,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0u,
location,
zip_entry->GetCrc32(),
kNoOatDexFile,
diff --git a/libdexfile/dex/art_dex_file_loader_test.cc b/libdexfile/dex/art_dex_file_loader_test.cc
index a7d0363..f7a2062 100644
--- a/libdexfile/dex/art_dex_file_loader_test.cc
+++ b/libdexfile/dex/art_dex_file_loader_test.cc
@@ -217,9 +217,9 @@
std::string plain_method = std::string("GetMethodSignature.") + r.name;
ASSERT_EQ(plain_method,
- raw->PrettyMethod(cur_method->GetIndex(), /* with_signature */ false));
+ raw->PrettyMethod(cur_method->GetIndex(), /* with_signature= */ false));
ASSERT_EQ(r.pretty_method,
- raw->PrettyMethod(cur_method->GetIndex(), /* with_signature */ true));
+ raw->PrettyMethod(cur_method->GetIndex(), /* with_signature= */ true));
}
}
@@ -332,8 +332,8 @@
std::string error_msg;
bool success = loader.Open(data_location_path.c_str(),
data_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
@@ -360,8 +360,8 @@
std::string error_msg;
bool success = loader.Open(system_location_path.c_str(),
system_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
@@ -388,8 +388,8 @@
std::string error_msg;
bool success = loader.Open(system_framework_location_path.c_str(),
system_framework_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
@@ -416,8 +416,8 @@
std::string error_msg;
bool success = loader.Open(data_multi_location_path.c_str(),
data_multi_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
@@ -445,8 +445,8 @@
std::string error_msg;
bool success = loader.Open(system_multi_location_path.c_str(),
system_multi_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
@@ -474,8 +474,8 @@
std::string error_msg;
bool success = loader.Open(system_framework_multi_location_path.c_str(),
system_framework_multi_location_path,
- /* verify */ false,
- /* verify_checksum */ false,
+ /* verify= */ false,
+ /* verify_checksum= */ false,
&error_msg,
&dex_files);
ASSERT_TRUE(success) << error_msg;
diff --git a/libdexfile/dex/code_item_accessors_test.cc b/libdexfile/dex/code_item_accessors_test.cc
index 2bb4dde..87f4bab 100644
--- a/libdexfile/dex/code_item_accessors_test.cc
+++ b/libdexfile/dex/code_item_accessors_test.cc
@@ -45,10 +45,10 @@
std::unique_ptr<const DexFile> dex(dex_file_loader.Open(data->data(),
data->size(),
"location",
- /*location_checksum*/ 123,
- /*oat_dex_file*/nullptr,
- /*verify*/false,
- /*verify_checksum*/false,
+ /*location_checksum=*/ 123,
+ /*oat_dex_file=*/nullptr,
+ /*verify=*/false,
+ /*verify_checksum=*/false,
&error_msg));
CHECK(dex != nullptr) << error_msg;
return dex;
@@ -56,11 +56,11 @@
TEST(CodeItemAccessorsTest, TestDexInstructionsAccessor) {
std::vector<uint8_t> standard_dex_data;
- std::unique_ptr<const DexFile> standard_dex(CreateFakeDex(/*compact_dex*/false,
+ std::unique_ptr<const DexFile> standard_dex(CreateFakeDex(/*compact_dex=*/false,
&standard_dex_data));
ASSERT_TRUE(standard_dex != nullptr);
std::vector<uint8_t> compact_dex_data;
- std::unique_ptr<const DexFile> compact_dex(CreateFakeDex(/*compact_dex*/true,
+ std::unique_ptr<const DexFile> compact_dex(CreateFakeDex(/*compact_dex=*/true,
&compact_dex_data));
ASSERT_TRUE(compact_dex != nullptr);
static constexpr uint16_t kRegisterSize = 2;
diff --git a/libdexfile/dex/compact_dex_file.cc b/libdexfile/dex/compact_dex_file.cc
index 302b59e..641c523 100644
--- a/libdexfile/dex/compact_dex_file.cc
+++ b/libdexfile/dex/compact_dex_file.cc
@@ -100,7 +100,7 @@
location_checksum,
oat_dex_file,
std::move(container),
- /*is_compact_dex*/ true),
+ /*is_compact_dex=*/ true),
debug_info_offsets_(DataBegin() + GetHeader().debug_info_offsets_pos_,
GetHeader().debug_info_base_,
GetHeader().debug_info_offsets_table_offset_) {}
diff --git a/libdexfile/dex/compact_dex_file_test.cc b/libdexfile/dex/compact_dex_file_test.cc
index 517c587..799967e 100644
--- a/libdexfile/dex/compact_dex_file_test.cc
+++ b/libdexfile/dex/compact_dex_file_test.cc
@@ -68,11 +68,11 @@
uint16_t out_outs_size;
uint16_t out_tries_size;
uint32_t out_insns_size_in_code_units;
- code_item->DecodeFields</*kDecodeOnlyInstructionCount*/false>(&out_insns_size_in_code_units,
- &out_registers_size,
- &out_ins_size,
- &out_outs_size,
- &out_tries_size);
+ code_item->DecodeFields</*kDecodeOnlyInstructionCount=*/false>(&out_insns_size_in_code_units,
+ &out_registers_size,
+ &out_ins_size,
+ &out_outs_size,
+ &out_tries_size);
ASSERT_EQ(registers_size, out_registers_size);
ASSERT_EQ(ins_size, out_ins_size);
ASSERT_EQ(outs_size, out_outs_size);
@@ -80,11 +80,11 @@
ASSERT_EQ(insns_size_in_code_units, out_insns_size_in_code_units);
++out_insns_size_in_code_units; // Force value to change.
- code_item->DecodeFields</*kDecodeOnlyInstructionCount*/true>(&out_insns_size_in_code_units,
- /*registers_size*/ nullptr,
- /*ins_size*/ nullptr,
- /*outs_size*/ nullptr,
- /*tries_size*/ nullptr);
+ code_item->DecodeFields</*kDecodeOnlyInstructionCount=*/true>(&out_insns_size_in_code_units,
+ /*registers_size=*/ nullptr,
+ /*ins_size=*/ nullptr,
+ /*outs_size=*/ nullptr,
+ /*tries_size=*/ nullptr);
ASSERT_EQ(insns_size_in_code_units, out_insns_size_in_code_units);
};
static constexpr uint32_t kMax32 = std::numeric_limits<uint32_t>::max();
diff --git a/libdexfile/dex/dex_file_loader.cc b/libdexfile/dex/dex_file_loader.cc
index 4aafc66..3667c8c 100644
--- a/libdexfile/dex/dex_file_loader.cc
+++ b/libdexfile/dex/dex_file_loader.cc
@@ -222,16 +222,16 @@
std::string* error_msg) const {
return OpenCommon(base,
size,
- /*data_base*/ nullptr,
- /*data_size*/ 0,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0,
location,
location_checksum,
oat_dex_file,
verify,
verify_checksum,
error_msg,
- /*container*/ nullptr,
- /*verify_result*/ nullptr);
+ /*container=*/ nullptr,
+ /*verify_result=*/ nullptr);
}
std::unique_ptr<const DexFile> DexFileLoader::OpenWithDataSection(
@@ -255,8 +255,8 @@
verify,
verify_checksum,
error_msg,
- /*container*/ nullptr,
- /*verify_result*/ nullptr);
+ /*container=*/ nullptr,
+ /*verify_result=*/ nullptr);
}
bool DexFileLoader::OpenAll(
@@ -290,7 +290,7 @@
size,
location,
dex_header->checksum_,
- /*oat_dex_file*/ nullptr,
+ /*oat_dex_file=*/ nullptr,
verify,
verify_checksum,
error_msg));
@@ -410,11 +410,11 @@
std::unique_ptr<const DexFile> dex_file = OpenCommon(
map.data(),
map.size(),
- /*data_base*/ nullptr,
- /*data_size*/ 0u,
+ /*data_base=*/ nullptr,
+ /*data_size=*/ 0u,
location,
zip_entry->GetCrc32(),
- /*oat_dex_file*/ nullptr,
+ /*oat_dex_file=*/ nullptr,
verify,
verify_checksum,
error_msg,
diff --git a/libdexfile/dex/dex_file_loader_test.cc b/libdexfile/dex/dex_file_loader_test.cc
index 5378617..9c61d1a 100644
--- a/libdexfile/dex/dex_file_loader_test.cc
+++ b/libdexfile/dex/dex_file_loader_test.cc
@@ -221,7 +221,7 @@
bool success = dex_file_loader.OpenAll(dex_bytes->data(),
dex_bytes->size(),
location,
- /* verify */ true,
+ /* verify= */ true,
kVerifyChecksum,
error_code,
error_msg,
@@ -256,9 +256,9 @@
dex_bytes->size(),
location,
location_checksum,
- /* oat_dex_file */ nullptr,
- /* verify */ true,
- /* verify_checksum */ true,
+ /* oat_dex_file= */ nullptr,
+ /* verify= */ true,
+ /* verify_checksum= */ true,
&error_message));
if (expect_success) {
CHECK(dex_file != nullptr) << error_message;
@@ -348,7 +348,7 @@
ASSERT_FALSE(dex_file_loader.OpenAll(dex_bytes.data(),
dex_bytes.size(),
kLocationString,
- /* verify */ true,
+ /* verify= */ true,
kVerifyChecksum,
&error_code,
&error_msg,
@@ -367,7 +367,7 @@
ASSERT_FALSE(dex_file_loader.OpenAll(dex_bytes.data(),
dex_bytes.size(),
kLocationString,
- /* verify */ true,
+ /* verify= */ true,
kVerifyChecksum,
&error_code,
&error_msg,
@@ -386,7 +386,7 @@
ASSERT_FALSE(dex_file_loader.OpenAll(dex_bytes.data(),
dex_bytes.size(),
kLocationString,
- /* verify */ true,
+ /* verify= */ true,
kVerifyChecksum,
&error_code,
&error_msg,
diff --git a/libdexfile/dex/dex_file_verifier.cc b/libdexfile/dex/dex_file_verifier.cc
index f273c84..499a89b 100644
--- a/libdexfile/dex/dex_file_verifier.cc
+++ b/libdexfile/dex/dex_file_verifier.cc
@@ -341,42 +341,43 @@
bool result =
CheckValidOffsetAndSize(header_->link_off_,
header_->link_size_,
- 0 /* unaligned */,
+ /* alignment= */ 0,
"link") &&
CheckValidOffsetAndSize(header_->map_off_,
header_->map_off_,
- 4,
+ /* alignment= */ 4,
"map") &&
CheckValidOffsetAndSize(header_->string_ids_off_,
header_->string_ids_size_,
- 4,
+ /* alignment= */ 4,
"string-ids") &&
CheckValidOffsetAndSize(header_->type_ids_off_,
header_->type_ids_size_,
- 4,
+ /* alignment= */ 4,
"type-ids") &&
CheckSizeLimit(header_->type_ids_size_, DexFile::kDexNoIndex16, "type-ids") &&
CheckValidOffsetAndSize(header_->proto_ids_off_,
header_->proto_ids_size_,
- 4,
+ /* alignment= */ 4,
"proto-ids") &&
CheckSizeLimit(header_->proto_ids_size_, DexFile::kDexNoIndex16, "proto-ids") &&
CheckValidOffsetAndSize(header_->field_ids_off_,
header_->field_ids_size_,
- 4,
+ /* alignment= */ 4,
"field-ids") &&
CheckValidOffsetAndSize(header_->method_ids_off_,
header_->method_ids_size_,
- 4,
+ /* alignment= */ 4,
"method-ids") &&
CheckValidOffsetAndSize(header_->class_defs_off_,
header_->class_defs_size_,
- 4,
+ /* alignment= */ 4,
"class-defs") &&
CheckValidOffsetAndSize(header_->data_off_,
header_->data_size_,
- 0, // Unaligned, spec doesn't talk about it, even though size
- // is supposed to be a multiple of 4.
+ // Unaligned, spec doesn't talk about it, even though size
+ // is supposed to be a multiple of 4.
+ /* alignment= */ 0,
"data");
return result;
}
@@ -1197,7 +1198,7 @@
ClassAccessor::Method method(*dex_file_, field.ptr_pos_);
if (!CheckIntraClassDataItemMethods(&method,
accessor.NumDirectMethods(),
- nullptr /* direct_it */,
+ /* direct_method= */ nullptr,
0u,
&have_class,
&class_type_index,
diff --git a/libdexfile/dex/dex_file_verifier_test.cc b/libdexfile/dex/dex_file_verifier_test.cc
index a22a457..c3180f0 100644
--- a/libdexfile/dex/dex_file_verifier_test.cc
+++ b/libdexfile/dex/dex_file_verifier_test.cc
@@ -107,8 +107,8 @@
bool success = dex_file_loader.OpenAll(dex_bytes.get(),
length,
location,
- /* verify */ true,
- /* verify_checksum */ true,
+ /* verify= */ true,
+ /* verify_checksum= */ true,
&error_code,
error_msg,
&tmp);
@@ -1621,13 +1621,13 @@
dex_file->Begin(),
dex_file->Size(),
"good checksum, no verify",
- /*verify_checksum*/ false,
+ /*verify_checksum=*/ false,
&error_msg));
EXPECT_TRUE(DexFileVerifier::Verify(dex_file.get(),
dex_file->Begin(),
dex_file->Size(),
"good checksum, verify",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
// Bad checksum: !verify_checksum passes verify_checksum fails.
@@ -1638,13 +1638,13 @@
dex_file->Begin(),
dex_file->Size(),
"bad checksum, no verify",
- /*verify_checksum*/ false,
+ /*verify_checksum=*/ false,
&error_msg));
EXPECT_FALSE(DexFileVerifier::Verify(dex_file.get(),
dex_file->Begin(),
dex_file->Size(),
"bad checksum, verify",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
EXPECT_NE(error_msg.find("Bad checksum"), std::string::npos) << error_msg;
}
@@ -1691,7 +1691,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad static method name",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -1735,7 +1735,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad virtual method name",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -1779,7 +1779,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad clinit signature",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -1823,7 +1823,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad clinit signature",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -1860,7 +1860,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad init signature",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -2063,7 +2063,7 @@
dex_file->Begin(),
dex_file->Size(),
"good checksum, verify",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
// TODO(oth): Test corruptions (b/35308502)
}
@@ -2110,7 +2110,7 @@
dex_file->Begin(),
dex_file->Size(),
"bad static field initial values array",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
@@ -2166,7 +2166,7 @@
dex_file->Begin(),
dex_file->Size(),
"good static field initial values array",
- /*verify_checksum*/ true,
+ /*verify_checksum=*/ true,
&error_msg));
}
diff --git a/libdexfile/dex/dex_instruction_test.cc b/libdexfile/dex/dex_instruction_test.cc
index 6ce9dba..02400f4 100644
--- a/libdexfile/dex/dex_instruction_test.cc
+++ b/libdexfile/dex/dex_instruction_test.cc
@@ -71,10 +71,13 @@
TEST(Instruction, PropertiesOf45cc) {
uint16_t instruction[4];
- Build45cc(4u /* num_vregs */, 16u /* method_idx */, 32u /* proto_idx */,
- 0xcafe /* arg_regs */, instruction);
+ Build45cc(/* num_args= */ 4u,
+ /* method_idx= */ 16u,
+ /* proto_idx= */ 32u,
+ /* arg_regs= */ 0xcafe,
+ instruction);
- DexInstructionIterator ins(instruction, /*dex_pc*/ 0u);
+ DexInstructionIterator ins(instruction, /*dex_pc=*/ 0u);
ASSERT_EQ(4u, ins->SizeInCodeUnits());
ASSERT_TRUE(ins->HasVRegA());
@@ -106,10 +109,13 @@
TEST(Instruction, PropertiesOf4rcc) {
uint16_t instruction[4];
- Build4rcc(4u /* num_vregs */, 16u /* method_idx */, 32u /* proto_idx */,
- 0xcafe /* arg_regs */, instruction);
+ Build4rcc(/* num_args= */ 4u,
+ /* method_idx= */ 16u,
+ /* proto_idx= */ 32u,
+ /* arg_regs_start= */ 0xcafe,
+ instruction);
- DexInstructionIterator ins(instruction, /*dex_pc*/ 0u);
+ DexInstructionIterator ins(instruction, /*dex_pc=*/ 0u);
ASSERT_EQ(4u, ins->SizeInCodeUnits());
ASSERT_TRUE(ins->HasVRegA());
diff --git a/libdexfile/dex/type_lookup_table.cc b/libdexfile/dex/type_lookup_table.cc
index 00ec358..7d80a2e 100644
--- a/libdexfile/dex/type_lookup_table.cc
+++ b/libdexfile/dex/type_lookup_table.cc
@@ -94,7 +94,7 @@
DCHECK_ALIGNED(raw_data, alignof(Entry));
const Entry* entries = reinterpret_cast<const Entry*>(raw_data);
size_t mask_bits = CalculateMaskBits(num_class_defs);
- return TypeLookupTable(dex_data_pointer, mask_bits, entries, /* owned_entries */ nullptr);
+ return TypeLookupTable(dex_data_pointer, mask_bits, entries, /* owned_entries= */ nullptr);
}
uint32_t TypeLookupTable::Lookup(const char* str, uint32_t hash) const {
diff --git a/libprofile/profile/profile_compilation_info.cc b/libprofile/profile/profile_compilation_info.cc
index 2ebde5e..6bd49a4 100644
--- a/libprofile/profile/profile_compilation_info.cc
+++ b/libprofile/profile/profile_compilation_info.cc
@@ -190,8 +190,8 @@
bool ProfileCompilationInfo::MergeWith(const std::string& filename) {
std::string error;
int flags = O_RDONLY | O_NOFOLLOW | O_CLOEXEC;
- ScopedFlock profile_file = LockedFile::Open(filename.c_str(), flags,
- /*block*/false, &error);
+ ScopedFlock profile_file =
+ LockedFile::Open(filename.c_str(), flags, /*block=*/false, &error);
if (profile_file.get() == nullptr) {
LOG(WARNING) << "Couldn't lock the profile file " << filename << ": " << error;
@@ -221,8 +221,8 @@
// There's no need to fsync profile data right away. We get many chances
// to write it again in case something goes wrong. We can rely on a simple
// close(), no sync, and let to the kernel decide when to write to disk.
- ScopedFlock profile_file = LockedFile::Open(filename.c_str(), flags,
- /*block*/false, &error);
+ ScopedFlock profile_file =
+ LockedFile::Open(filename.c_str(), flags, /*block=*/false, &error);
if (profile_file.get() == nullptr) {
LOG(WARNING) << "Couldn't lock the profile file " << filename << ": " << error;
@@ -259,8 +259,8 @@
// There's no need to fsync profile data right away. We get many chances
// to write it again in case something goes wrong. We can rely on a simple
// close(), no sync, and let to the kernel decide when to write to disk.
- ScopedFlock profile_file = LockedFile::Open(filename.c_str(), flags,
- /*block*/false, &error);
+ ScopedFlock profile_file =
+ LockedFile::Open(filename.c_str(), flags, /*block=*/false, &error);
if (profile_file.get() == nullptr) {
LOG(WARNING) << "Couldn't lock the profile file " << filename << ": " << error;
return false;
@@ -1393,8 +1393,8 @@
// verify_checksum is false because we want to differentiate between a missing dex data and
// a mismatched checksum.
const DexFileData* dex_data = FindDexData(other_profile_line_header.dex_location,
- 0u,
- false /* verify_checksum */);
+ /* checksum= */ 0u,
+ /* verify_checksum= */ false);
if ((dex_data != nullptr) && (dex_data->checksum != other_profile_line_header.checksum)) {
LOG(WARNING) << "Checksum mismatch for dex " << other_profile_line_header.dex_location;
return false;
@@ -1481,8 +1481,8 @@
// verify_checksum is false because we want to differentiate between a missing dex data and
// a mismatched checksum.
const DexFileData* dex_data = FindDexData(other_dex_data->profile_key,
- 0u,
- /* verify_checksum */ false);
+ /* checksum= */ 0u,
+ /* verify_checksum= */ false);
if ((dex_data != nullptr) && (dex_data->checksum != other_dex_data->checksum)) {
LOG(WARNING) << "Checksum mismatch for dex " << other_dex_data->profile_key;
return false;
@@ -1829,7 +1829,7 @@
flags |= ((m & 1) != 0) ? MethodHotness::kFlagPostStartup : MethodHotness::kFlagStartup;
info.AddMethodIndex(static_cast<MethodHotness::Flag>(flags),
profile_key,
- /*method_idx*/ 0,
+ /*checksum=*/ 0,
method_idx,
max_method);
}
@@ -1975,20 +1975,20 @@
MethodHotness::Flag flags) {
DCHECK_LT(index, num_method_ids);
if ((flags & MethodHotness::kFlagStartup) != 0) {
- method_bitmap.StoreBit(MethodBitIndex(/*startup*/ true, index), /*value*/ true);
+ method_bitmap.StoreBit(MethodBitIndex(/*startup=*/ true, index), /*value=*/ true);
}
if ((flags & MethodHotness::kFlagPostStartup) != 0) {
- method_bitmap.StoreBit(MethodBitIndex(/*startup*/ false, index), /*value*/ true);
+ method_bitmap.StoreBit(MethodBitIndex(/*startup=*/ false, index), /*value=*/ true);
}
}
ProfileCompilationInfo::MethodHotness ProfileCompilationInfo::DexFileData::GetHotnessInfo(
uint32_t dex_method_index) const {
MethodHotness ret;
- if (method_bitmap.LoadBit(MethodBitIndex(/*startup*/ true, dex_method_index))) {
+ if (method_bitmap.LoadBit(MethodBitIndex(/*startup=*/ true, dex_method_index))) {
ret.AddFlag(MethodHotness::kFlagStartup);
}
- if (method_bitmap.LoadBit(MethodBitIndex(/*startup*/ false, dex_method_index))) {
+ if (method_bitmap.LoadBit(MethodBitIndex(/*startup=*/ false, dex_method_index))) {
ret.AddFlag(MethodHotness::kFlagPostStartup);
}
auto it = method_map.find(dex_method_index);
diff --git a/libprofile/profile/profile_compilation_info_test.cc b/libprofile/profile/profile_compilation_info_test.cc
index 417abaa..a2bfe50 100644
--- a/libprofile/profile/profile_compilation_info_test.cc
+++ b/libprofile/profile/profile_compilation_info_test.cc
@@ -43,22 +43,22 @@
protected:
bool AddMethod(const std::string& dex_location,
uint32_t checksum,
- uint16_t method_index,
+ uint16_t method_idx,
ProfileCompilationInfo* info) {
return info->AddMethodIndex(Hotness::kFlagHot,
dex_location,
checksum,
- method_index,
+ method_idx,
kMaxMethodIds);
}
bool AddMethod(const std::string& dex_location,
uint32_t checksum,
- uint16_t method_index,
+ uint16_t method_idx,
const ProfileCompilationInfo::OfflineProfileMethodInfo& pmi,
ProfileCompilationInfo* info) {
return info->AddMethod(
- dex_location, checksum, method_index, kMaxMethodIds, pmi, Hotness::kFlagPostStartup);
+ dex_location, checksum, method_idx, kMaxMethodIds, pmi, Hotness::kFlagPostStartup);
}
bool AddClass(const std::string& dex_location,
@@ -115,9 +115,9 @@
ProfileCompilationInfo::OfflineProfileMethodInfo pmi(ic_map);
- pmi.dex_references.emplace_back("dex_location1", /* checksum */1, kMaxMethodIds);
- pmi.dex_references.emplace_back("dex_location2", /* checksum */2, kMaxMethodIds);
- pmi.dex_references.emplace_back("dex_location3", /* checksum */3, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location1", /* checksum= */1, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location2", /* checksum= */2, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location3", /* checksum= */3, kMaxMethodIds);
return pmi;
}
@@ -148,8 +148,8 @@
ScratchFile profile;
ProfileCompilationInfo saved_info;
for (uint16_t i = 0; i < 10; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, /* method_idx */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, /* method_idx= */ i, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
ASSERT_EQ(0, profile.GetFile()->Flush());
@@ -207,8 +207,8 @@
ProfileCompilationInfo saved_info;
// Save a few methods.
for (uint16_t i = 0; i < 10; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, /* method_idx */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, /* method_idx= */ i, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
ASSERT_EQ(0, profile.GetFile()->Flush());
@@ -221,9 +221,9 @@
// Save more methods.
for (uint16_t i = 0; i < 100; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, /* method_idx */ i, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location3", /* checksum */ 3, /* method_idx */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, /* method_idx= */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location3", /* checksum= */ 3, /* method_idx= */ i, &saved_info));
}
ASSERT_TRUE(profile.GetFile()->ResetOffset());
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -240,19 +240,19 @@
ScratchFile profile;
ProfileCompilationInfo info;
- ASSERT_TRUE(AddMethod("dex_location", /* checksum */ 1, /* method_idx */ 1, &info));
+ ASSERT_TRUE(AddMethod("dex_location", /* checksum= */ 1, /* method_idx= */ 1, &info));
// Trying to add info for an existing file but with a different checksum.
- ASSERT_FALSE(AddMethod("dex_location", /* checksum */ 2, /* method_idx */ 2, &info));
+ ASSERT_FALSE(AddMethod("dex_location", /* checksum= */ 2, /* method_idx= */ 2, &info));
}
TEST_F(ProfileCompilationInfoTest, MergeFail) {
ScratchFile profile;
ProfileCompilationInfo info1;
- ASSERT_TRUE(AddMethod("dex_location", /* checksum */ 1, /* method_idx */ 1, &info1));
+ ASSERT_TRUE(AddMethod("dex_location", /* checksum= */ 1, /* method_idx= */ 1, &info1));
// Use the same file, change the checksum.
ProfileCompilationInfo info2;
- ASSERT_TRUE(AddMethod("dex_location", /* checksum */ 2, /* method_idx */ 2, &info2));
+ ASSERT_TRUE(AddMethod("dex_location", /* checksum= */ 2, /* method_idx= */ 2, &info2));
ASSERT_FALSE(info1.MergeWith(info2));
}
@@ -262,10 +262,10 @@
ScratchFile profile;
ProfileCompilationInfo info1;
- ASSERT_TRUE(AddMethod("dex_location", /* checksum */ 1, /* method_idx */ 1, &info1));
+ ASSERT_TRUE(AddMethod("dex_location", /* checksum= */ 1, /* method_idx= */ 1, &info1));
// Use the same file, change the checksum.
ProfileCompilationInfo info2;
- ASSERT_TRUE(AddMethod("dex_location", /* checksum */ 2, /* method_idx */ 2, &info2));
+ ASSERT_TRUE(AddMethod("dex_location", /* checksum= */ 2, /* method_idx= */ 2, &info2));
ASSERT_TRUE(info1.Save(profile.GetFd()));
ASSERT_EQ(0, profile.GetFile()->Flush());
@@ -280,13 +280,13 @@
ProfileCompilationInfo saved_info;
// Save the maximum number of methods
for (uint16_t i = 0; i < std::numeric_limits<uint16_t>::max(); i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, /* method_idx */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, /* method_idx= */ i, &saved_info));
}
// Save the maximum number of classes
for (uint16_t i = 0; i < std::numeric_limits<uint16_t>::max(); i++) {
- ASSERT_TRUE(AddClass("dex_location1", /* checksum */ 1, dex::TypeIndex(i), &saved_info));
- ASSERT_TRUE(AddClass("dex_location2", /* checksum */ 2, dex::TypeIndex(i), &saved_info));
+ ASSERT_TRUE(AddClass("dex_location1", /* checksum= */ 1, dex::TypeIndex(i), &saved_info));
+ ASSERT_TRUE(AddClass("dex_location2", /* checksum= */ 2, dex::TypeIndex(i), &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -390,7 +390,7 @@
ProfileCompilationInfo saved_info;
// Save the maximum number of methods
for (uint16_t i = 0; i < 10; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -415,9 +415,9 @@
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
// Add a method which is part of the same dex file as one of the
// class from the inline caches.
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
// Add a method which is outside the set of dex files.
- ASSERT_TRUE(AddMethod("dex_location4", /* checksum */ 4, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location4", /* checksum= */ 4, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -431,11 +431,11 @@
ASSERT_TRUE(loaded_info.Equals(saved_info));
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- loaded_info.GetMethod("dex_location1", /* checksum */ 1, /* method_idx */ 3);
+ loaded_info.GetMethod("dex_location1", /* dex_checksum= */ 1, /* dex_method_index= */ 3);
ASSERT_TRUE(loaded_pmi1 != nullptr);
ASSERT_TRUE(*loaded_pmi1 == pmi);
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi2 =
- loaded_info.GetMethod("dex_location4", /* checksum */ 4, /* method_idx */ 3);
+ loaded_info.GetMethod("dex_location4", /* dex_checksum= */ 4, /* dex_method_index= */ 3);
ASSERT_TRUE(loaded_pmi2 != nullptr);
ASSERT_TRUE(*loaded_pmi2 == pmi);
}
@@ -448,7 +448,7 @@
// Add methods with inline caches.
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -459,7 +459,7 @@
ProfileCompilationInfo::OfflineProfileMethodInfo pmi_extra = GetOfflineProfileMethodInfo();
MakeMegamorphic(&pmi_extra);
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info_extra));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info_extra));
}
ASSERT_TRUE(profile.GetFile()->ResetOffset());
@@ -477,7 +477,7 @@
ASSERT_TRUE(loaded_info.Equals(saved_info));
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- loaded_info.GetMethod("dex_location1", /* checksum */ 1, /* method_idx */ 3);
+ loaded_info.GetMethod("dex_location1", /* dex_checksum= */ 1, /* dex_method_index= */ 3);
ASSERT_TRUE(loaded_pmi1 != nullptr);
ASSERT_TRUE(*loaded_pmi1 == pmi_extra);
@@ -491,7 +491,7 @@
// Add methods with inline caches.
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -502,7 +502,7 @@
ProfileCompilationInfo::OfflineProfileMethodInfo pmi_extra = GetOfflineProfileMethodInfo();
MakeMegamorphic(&pmi_extra);
for (uint16_t method_idx = 5; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info_extra));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info_extra));
}
// Mark all inline caches with missing types and add them to the profile again.
@@ -510,7 +510,7 @@
ProfileCompilationInfo::OfflineProfileMethodInfo missing_types = GetOfflineProfileMethodInfo();
SetIsMissingTypes(&missing_types);
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info_extra));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info_extra));
}
ASSERT_TRUE(profile.GetFile()->ResetOffset());
@@ -528,7 +528,7 @@
ASSERT_TRUE(loaded_info.Equals(saved_info));
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- loaded_info.GetMethod("dex_location1", /* checksum */ 1, /* method_idx */ 3);
+ loaded_info.GetMethod("dex_location1", /* dex_checksum= */ 1, /* dex_method_index= */ 3);
ASSERT_TRUE(loaded_pmi1 != nullptr);
ASSERT_TRUE(*loaded_pmi1 == pmi_extra);
}
@@ -542,8 +542,8 @@
// Modify the checksum to trigger a mismatch.
pmi2.dex_references[0].dex_checksum++;
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /*method_idx*/ 0, pmi1, &info));
- ASSERT_FALSE(AddMethod("dex_location2", /* checksum */ 2, /*method_idx*/ 0, pmi2, &info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /*method_idx=*/ 0, pmi1, &info));
+ ASSERT_FALSE(AddMethod("dex_location2", /* checksum= */ 2, /*method_idx=*/ 0, pmi2, &info));
}
// Verify that profiles behave correctly even if the methods are added in a different
@@ -556,8 +556,8 @@
ProfileCompilationInfo::InlineCacheMap* ic_map = CreateInlineCacheMap();
ProfileCompilationInfo::OfflineProfileMethodInfo pmi(ic_map);
- pmi.dex_references.emplace_back("dex_location1", /* checksum */ 1, kMaxMethodIds);
- pmi.dex_references.emplace_back("dex_location2", /* checksum */ 2, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location1", /* checksum= */ 1, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location2", /* checksum= */ 2, kMaxMethodIds);
for (uint16_t dex_pc = 1; dex_pc < 5; dex_pc++) {
ProfileCompilationInfo::DexPcData dex_pc_data(allocator_.get());
dex_pc_data.AddClass(0, dex::TypeIndex(0));
@@ -567,8 +567,8 @@
ProfileCompilationInfo::InlineCacheMap* ic_map_reindexed = CreateInlineCacheMap();
ProfileCompilationInfo::OfflineProfileMethodInfo pmi_reindexed(ic_map_reindexed);
- pmi_reindexed.dex_references.emplace_back("dex_location2", /* checksum */ 2, kMaxMethodIds);
- pmi_reindexed.dex_references.emplace_back("dex_location1", /* checksum */ 1, kMaxMethodIds);
+ pmi_reindexed.dex_references.emplace_back("dex_location2", /* checksum= */ 2, kMaxMethodIds);
+ pmi_reindexed.dex_references.emplace_back("dex_location1", /* checksum= */ 1, kMaxMethodIds);
for (uint16_t dex_pc = 1; dex_pc < 5; dex_pc++) {
ProfileCompilationInfo::DexPcData dex_pc_data(allocator_.get());
dex_pc_data.AddClass(1, dex::TypeIndex(0));
@@ -579,15 +579,15 @@
// Profile 1 and Profile 2 get the same methods but in different order.
// This will trigger a different dex numbers.
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, method_idx, pmi, &info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, method_idx, pmi, &info));
}
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
ASSERT_TRUE(AddMethod(
- "dex_location2", /* checksum */ 2, method_idx, pmi_reindexed, &info_reindexed));
+ "dex_location2", /* checksum= */ 2, method_idx, pmi_reindexed, &info_reindexed));
ASSERT_TRUE(AddMethod(
- "dex_location1", /* checksum */ 1, method_idx, pmi_reindexed, &info_reindexed));
+ "dex_location1", /* checksum= */ 1, method_idx, pmi_reindexed, &info_reindexed));
}
ProfileCompilationInfo info_backup;
@@ -597,11 +597,11 @@
ASSERT_TRUE(info.Equals(info_backup));
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- info.GetMethod("dex_location1", /* checksum */ 1, method_idx);
+ info.GetMethod("dex_location1", /* dex_checksum= */ 1, method_idx);
ASSERT_TRUE(loaded_pmi1 != nullptr);
ASSERT_TRUE(*loaded_pmi1 == pmi);
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi2 =
- info.GetMethod("dex_location2", /* checksum */ 2, method_idx);
+ info.GetMethod("dex_location2", /* dex_checksum= */ 2, method_idx);
ASSERT_TRUE(loaded_pmi2 != nullptr);
ASSERT_TRUE(*loaded_pmi2 == pmi);
}
@@ -612,34 +612,34 @@
// Save a few methods.
for (uint16_t i = 0; i < std::numeric_limits<uint8_t>::max(); i++) {
std::string dex_location = std::to_string(i);
- ASSERT_TRUE(AddMethod(dex_location, /* checksum */ 1, /* method_idx */ i, &info));
+ ASSERT_TRUE(AddMethod(dex_location, /* checksum= */ 1, /* method_idx= */ i, &info));
}
// We only support at most 255 dex files.
ASSERT_FALSE(AddMethod(
- /*dex_location*/ "256", /* checksum */ 1, /* method_idx */ 0, &info));
+ /*dex_location=*/ "256", /* checksum= */ 1, /* method_idx= */ 0, &info));
}
TEST_F(ProfileCompilationInfoTest, MegamorphicInlineCachesMerge) {
// Create a megamorphic inline cache.
ProfileCompilationInfo::InlineCacheMap* ic_map = CreateInlineCacheMap();
ProfileCompilationInfo::OfflineProfileMethodInfo pmi(ic_map);
- pmi.dex_references.emplace_back("dex_location1", /* checksum */ 1, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location1", /* checksum= */ 1, kMaxMethodIds);
ProfileCompilationInfo::DexPcData dex_pc_data(allocator_.get());
dex_pc_data.SetIsMegamorphic();
ic_map->Put(/*dex_pc*/ 0, dex_pc_data);
ProfileCompilationInfo info_megamorphic;
ASSERT_TRUE(AddMethod("dex_location1",
- /*checksum*/ 1,
- /*method_idx*/ 0,
+ /*checksum=*/ 1,
+ /*method_idx=*/ 0,
pmi,
&info_megamorphic));
// Create a profile with no inline caches (for the same method).
ProfileCompilationInfo info_no_inline_cache;
ASSERT_TRUE(AddMethod("dex_location1",
- /*checksum*/ 1,
- /*method_idx*/ 0,
+ /*checksum=*/ 1,
+ /*method_idx=*/ 0,
&info_no_inline_cache));
// Merge the megamorphic cache into the empty one.
@@ -653,23 +653,23 @@
// Create an inline cache with missing types
ProfileCompilationInfo::InlineCacheMap* ic_map = CreateInlineCacheMap();
ProfileCompilationInfo::OfflineProfileMethodInfo pmi(ic_map);
- pmi.dex_references.emplace_back("dex_location1", /* checksum */ 1, kMaxMethodIds);
+ pmi.dex_references.emplace_back("dex_location1", /* checksum= */ 1, kMaxMethodIds);
ProfileCompilationInfo::DexPcData dex_pc_data(allocator_.get());
dex_pc_data.SetIsMissingTypes();
ic_map->Put(/*dex_pc*/ 0, dex_pc_data);
ProfileCompilationInfo info_megamorphic;
ASSERT_TRUE(AddMethod("dex_location1",
- /*checksum*/ 1,
- /*method_idx*/ 0,
+ /*checksum=*/ 1,
+ /*method_idx=*/ 0,
pmi,
&info_megamorphic));
// Create a profile with no inline caches (for the same method).
ProfileCompilationInfo info_no_inline_cache;
ASSERT_TRUE(AddMethod("dex_location1",
- /*checksum*/ 1,
- /*method_idx*/ 0,
+ /*checksum=*/ 1,
+ /*method_idx=*/ 0,
&info_no_inline_cache));
// Merge the missing type cache into the empty one.
@@ -766,26 +766,26 @@
TEST_F(ProfileCompilationInfoTest, LoadFromZipCompress) {
TestProfileLoadFromZip("primary.prof",
ZipWriter::kCompress | ZipWriter::kAlign32,
- /*should_succeed*/true);
+ /*should_succeed=*/true);
}
TEST_F(ProfileCompilationInfoTest, LoadFromZipUnCompress) {
TestProfileLoadFromZip("primary.prof",
ZipWriter::kAlign32,
- /*should_succeed*/true);
+ /*should_succeed=*/true);
}
TEST_F(ProfileCompilationInfoTest, LoadFromZipUnAligned) {
TestProfileLoadFromZip("primary.prof",
0,
- /*should_succeed*/true);
+ /*should_succeed=*/true);
}
TEST_F(ProfileCompilationInfoTest, LoadFromZipFailBadZipEntry) {
TestProfileLoadFromZip("invalid.profile.entry",
0,
- /*should_succeed*/true,
- /*should_succeed_with_empty_profile*/true);
+ /*should_succeed=*/true,
+ /*should_succeed_with_empty_profile=*/true);
}
TEST_F(ProfileCompilationInfoTest, LoadFromZipFailBadProfile) {
@@ -835,7 +835,7 @@
info.AddMethodIndex(Hotness::kFlagHot,
old_name,
dex->GetLocationChecksum(),
- /* method_idx */ 0,
+ /* method_idx= */ 0,
dex->NumMethodIds());
}
@@ -845,7 +845,7 @@
// Verify that we find the methods when searched with the original dex files.
for (const std::unique_ptr<const DexFile>& dex : dex_files) {
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi =
- info.GetMethod(dex->GetLocation(), dex->GetLocationChecksum(), /* method_idx */ 0);
+ info.GetMethod(dex->GetLocation(), dex->GetLocationChecksum(), /* dex_method_index= */ 0);
ASSERT_TRUE(loaded_pmi != nullptr);
}
}
@@ -856,9 +856,9 @@
ProfileCompilationInfo info;
info.AddMethodIndex(Hotness::kFlagHot,
"my.app",
- /* checksum */ 123,
- /* method_idx */ 0,
- /* num_method_ids */ 10);
+ /* checksum= */ 123,
+ /* method_idx= */ 0,
+ /* num_method_ids= */ 10);
// Update the profile keys based on the original dex files
ASSERT_TRUE(info.UpdateProfileKeys(dex_files));
@@ -867,13 +867,13 @@
// location.
for (const std::unique_ptr<const DexFile>& dex : dex_files) {
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi =
- info.GetMethod(dex->GetLocation(), dex->GetLocationChecksum(), /* method_idx */ 0);
+ info.GetMethod(dex->GetLocation(), dex->GetLocationChecksum(), /* dex_method_index= */ 0);
ASSERT_TRUE(loaded_pmi == nullptr);
}
// Verify that we can find the original entry.
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi =
- info.GetMethod("my.app", /* checksum */ 123, /* method_idx */ 0);
+ info.GetMethod("my.app", /* dex_checksum= */ 123, /* dex_method_index= */ 0);
ASSERT_TRUE(loaded_pmi != nullptr);
}
@@ -892,7 +892,7 @@
info.AddMethodIndex(Hotness::kFlagHot,
old_name,
dex->GetLocationChecksum(),
- /* method_idx */ 0,
+ /* method_idx= */ 0,
dex->NumMethodIds());
}
@@ -900,8 +900,8 @@
// This will cause the rename to fail because an existing entry would already have that name.
info.AddMethodIndex(Hotness::kFlagHot,
dex_files[0]->GetLocation(),
- /* checksum */ 123,
- /* method_idx */ 0,
+ /* checksum= */ 123,
+ /* method_idx= */ 0,
dex_files[0]->NumMethodIds());
ASSERT_FALSE(info.UpdateProfileKeys(dex_files));
@@ -916,10 +916,10 @@
// Add methods with inline caches.
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
// Add a method which is part of the same dex file as one of the class from the inline caches.
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, method_idx, pmi, &saved_info));
// Add a method which is outside the set of dex files.
- ASSERT_TRUE(AddMethod("dex_location4", /* checksum */ 4, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location4", /* checksum= */ 4, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -941,8 +941,12 @@
// Dex location 2 and 4 should have been filtered out
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
- ASSERT_TRUE(nullptr == loaded_info.GetMethod("dex_location2", /* checksum */ 2, method_idx));
- ASSERT_TRUE(nullptr == loaded_info.GetMethod("dex_location4", /* checksum */ 4, method_idx));
+ ASSERT_TRUE(nullptr == loaded_info.GetMethod("dex_location2",
+ /* dex_checksum= */ 2,
+ method_idx));
+ ASSERT_TRUE(nullptr == loaded_info.GetMethod("dex_location4",
+ /* dex_checksum= */ 4,
+ method_idx));
}
// Dex location 1 should have all all the inline caches referencing dex location 2 set to
@@ -950,7 +954,7 @@
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
// The methods for dex location 1 should be in the profile data.
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- loaded_info.GetMethod("dex_location1", /* checksum */ 1, /* method_idx */ method_idx);
+ loaded_info.GetMethod("dex_location1", /* dex_checksum= */ 1, method_idx);
ASSERT_TRUE(loaded_pmi1 != nullptr);
// Verify the inline cache.
@@ -989,8 +993,8 @@
ProfileCompilationInfo::OfflineProfileMethodInfo expected_pmi(ic_map);
// The dex references should not have dex_location2 in the list.
- expected_pmi.dex_references.emplace_back("dex_location1", /* checksum */1, kMaxMethodIds);
- expected_pmi.dex_references.emplace_back("dex_location3", /* checksum */3, kMaxMethodIds);
+ expected_pmi.dex_references.emplace_back("dex_location1", /* checksum= */1, kMaxMethodIds);
+ expected_pmi.dex_references.emplace_back("dex_location3", /* checksum= */3, kMaxMethodIds);
// Now check that we get back what we expect.
ASSERT_TRUE(*loaded_pmi1 == expected_pmi);
@@ -1006,10 +1010,10 @@
// Add methods with inline caches.
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
// Add a method which is part of the same dex file as one of the class from the inline caches.
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
- ASSERT_TRUE(AddMethod("dex_location2", /* checksum */ 2, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location2", /* checksum= */ 2, method_idx, pmi, &saved_info));
// Add a method which is outside the set of dex files.
- ASSERT_TRUE(AddMethod("dex_location4", /* checksum */ 4, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location4", /* checksum= */ 4, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -1038,9 +1042,9 @@
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
// Add a method which is part of the same dex file as one of the
// class from the inline caches.
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, method_idx, pmi, &saved_info));
// Add a method which is outside the set of dex files.
- ASSERT_TRUE(AddMethod("dex_location4", /* checksum */ 4, method_idx, pmi, &saved_info));
+ ASSERT_TRUE(AddMethod("dex_location4", /* checksum= */ 4, method_idx, pmi, &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -1060,13 +1064,13 @@
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi1 =
- loaded_info.GetMethod("dex_location1", /* checksum */ 1, method_idx);
+ loaded_info.GetMethod("dex_location1", /* dex_checksum= */ 1, method_idx);
ASSERT_TRUE(loaded_pmi1 != nullptr);
ASSERT_TRUE(*loaded_pmi1 == pmi);
}
for (uint16_t method_idx = 0; method_idx < 10; method_idx++) {
std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> loaded_pmi2 =
- loaded_info.GetMethod("dex_location4", /* checksum */ 4, method_idx);
+ loaded_info.GetMethod("dex_location4", /* dex_checksum= */ 4, method_idx);
ASSERT_TRUE(loaded_pmi2 != nullptr);
ASSERT_TRUE(*loaded_pmi2 == pmi);
}
@@ -1081,8 +1085,8 @@
ProfileCompilationInfo saved_info;
uint16_t item_count = 1000;
for (uint16_t i = 0; i < item_count; i++) {
- ASSERT_TRUE(AddClass("dex_location1", /* checksum */ 1, dex::TypeIndex(i), &saved_info));
- ASSERT_TRUE(AddClass("dex_location2", /* checksum */ 2, dex::TypeIndex(i), &saved_info));
+ ASSERT_TRUE(AddClass("dex_location1", /* checksum= */ 1, dex::TypeIndex(i), &saved_info));
+ ASSERT_TRUE(AddClass("dex_location2", /* checksum= */ 2, dex::TypeIndex(i), &saved_info));
}
ASSERT_TRUE(saved_info.Save(GetFd(profile)));
@@ -1101,7 +1105,7 @@
// Compute the expectation.
ProfileCompilationInfo expected_info;
for (uint16_t i = 0; i < item_count; i++) {
- ASSERT_TRUE(AddClass("dex_location2", /* checksum */ 2, dex::TypeIndex(i), &expected_info));
+ ASSERT_TRUE(AddClass("dex_location2", /* checksum= */ 2, dex::TypeIndex(i), &expected_info));
}
// Validate the expectation.
@@ -1112,7 +1116,7 @@
TEST_F(ProfileCompilationInfoTest, ClearData) {
ProfileCompilationInfo info;
for (uint16_t i = 0; i < 10; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &info));
}
ASSERT_FALSE(IsEmpty(info));
info.ClearData();
@@ -1122,7 +1126,7 @@
TEST_F(ProfileCompilationInfoTest, ClearDataAndSave) {
ProfileCompilationInfo info;
for (uint16_t i = 0; i < 10; i++) {
- ASSERT_TRUE(AddMethod("dex_location1", /* checksum */ 1, /* method_idx */ i, &info));
+ ASSERT_TRUE(AddMethod("dex_location1", /* checksum= */ 1, /* method_idx= */ i, &info));
}
info.ClearData();