Merge "[aapt2] Fix infinite loop in proguard::CollectLocations" am: 39146bcc18
am: b9150119f8
Change-Id: I6cd248db327a66c74a39165ebc8145ce90afc5b4
This commit is contained in:
@@ -99,11 +99,13 @@ bool CollectLocations(const UsageLocation& location, const KeepSet& keep_set,
|
||||
//
|
||||
|
||||
inline bool operator==(const UsageLocation& lhs, const UsageLocation& rhs) {
|
||||
// The "source" member is ignored because we only need "name" for outputting
|
||||
// keep rules; "source" is used for comments.
|
||||
return lhs.name == rhs.name;
|
||||
}
|
||||
|
||||
inline int operator<(const UsageLocation& lhs, const UsageLocation& rhs) {
|
||||
return lhs.name.compare(rhs.name);
|
||||
inline bool operator<(const UsageLocation& lhs, const UsageLocation& rhs) {
|
||||
return lhs.name.compare(rhs.name) < 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -364,4 +364,12 @@ TEST(ProguardRulesTest, TransitionRulesAreEmitted) {
|
||||
"-keep class com.foo.Bar { <init>(android.content.Context, android.util.AttributeSet); }"));
|
||||
}
|
||||
|
||||
TEST(ProguardRulesTest, UsageLocationComparator) {
|
||||
proguard::UsageLocation location1 = {{"pkg", ResourceType::kAttr, "x"}};
|
||||
proguard::UsageLocation location2 = {{"pkg", ResourceType::kAttr, "y"}};
|
||||
|
||||
EXPECT_EQ(location1 < location2, true);
|
||||
EXPECT_EQ(location2 < location1, false);
|
||||
}
|
||||
|
||||
} // namespace aapt
|
||||
|
||||
Reference in New Issue
Block a user