Fix StringReferenceValueComparator.
Test: Added a regression test in string_reference_test.cc,
run the standard ART test suite on host and Nexus 5.
Bug: 29602109
Change-Id: Idcc059a07df048a0e3ece257b16b6556f242243e
diff --git a/compiler/utils/string_reference.h b/compiler/utils/string_reference.h
index 9e1058e..0ab45c8 100644
--- a/compiler/utils/string_reference.h
+++ b/compiler/utils/string_reference.h
@@ -20,12 +20,11 @@
#include <stdint.h>
#include "base/logging.h"
+#include "dex_file-inl.h"
#include "utf-inl.h"
namespace art {
-class DexFile;
-
// A string is located by its DexFile and the string_ids_ table index into that DexFile.
struct StringReference {
StringReference(const DexFile* file, uint32_t index) : dex_file(file), string_index(index) { }
@@ -48,13 +47,13 @@
sr1.string_index < sr2.string_index,
CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(
sr1.dex_file->GetStringData(sr1.dex_file->GetStringId(sr1.string_index)),
- sr1.dex_file->GetStringData(sr2.dex_file->GetStringId(sr2.string_index))) < 0);
+ sr2.dex_file->GetStringData(sr2.dex_file->GetStringId(sr2.string_index))) < 0);
return sr1.string_index < sr2.string_index;
} else {
// Cannot compare indexes, so do the string comparison.
return CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(
sr1.dex_file->GetStringData(sr1.dex_file->GetStringId(sr1.string_index)),
- sr1.dex_file->GetStringData(sr2.dex_file->GetStringId(sr2.string_index))) < 0;
+ sr2.dex_file->GetStringData(sr2.dex_file->GetStringId(sr2.string_index))) < 0;
}
}
};