Fix up TODO: c++0x, update cpplint.
Needed to update cpplint to handle const auto.
Fixed a few cpplint errors that were being missed before.
Replaced most of the TODO c++0x with ranged based loops. Loops which
do not have a descriptive container name have a concrete type instead
of auto.
Change-Id: Id7cc0f27030f56057c544e94277300b3f298c9c5
diff --git a/runtime/intern_table.cc b/runtime/intern_table.cc
index e2c1a64..d7398ca 100644
--- a/runtime/intern_table.cc
+++ b/runtime/intern_table.cc
@@ -40,9 +40,8 @@
void InternTable::VisitRoots(RootVisitor* visitor, void* arg, bool clean_dirty) {
MutexLock mu(Thread::Current(), intern_table_lock_);
- typedef Table::const_iterator It; // TODO: C++0x auto
- for (It it = strong_interns_.begin(), end = strong_interns_.end(); it != end; ++it) {
- visitor(it->second, arg);
+ for (const auto& strong_intern : strong_interns_) {
+ visitor(strong_intern.second, arg);
}
if (clean_dirty) {
is_dirty_ = false;
@@ -52,8 +51,7 @@
mirror::String* InternTable::Lookup(Table& table, mirror::String* s, uint32_t hash_code) {
intern_table_lock_.AssertHeld(Thread::Current());
- typedef Table::const_iterator It; // TODO: C++0x auto
- for (It it = table.find(hash_code), end = table.end(); it != end; ++it) {
+ for (auto it = table.find(hash_code), end = table.end(); it != end; ++it) {
mirror::String* existing_string = it->second;
if (existing_string->Equals(s)) {
return existing_string;
@@ -75,8 +73,7 @@
void InternTable::Remove(Table& table, const mirror::String* s, uint32_t hash_code) {
intern_table_lock_.AssertHeld(Thread::Current());
- typedef Table::iterator It; // TODO: C++0x auto
- for (It it = table.find(hash_code), end = table.end(); it != end; ++it) {
+ for (auto it = table.find(hash_code), end = table.end(); it != end; ++it) {
if (it->second == s) {
table.erase(it);
return;
@@ -166,8 +163,8 @@
void InternTable::SweepInternTableWeaks(IsMarkedTester is_marked, void* arg) {
MutexLock mu(Thread::Current(), intern_table_lock_);
- typedef Table::iterator It; // TODO: C++0x auto
- for (It it = weak_interns_.begin(), end = weak_interns_.end(); it != end;) {
+ // TODO: std::remove_if + lambda.
+ for (auto it = weak_interns_.begin(), end = weak_interns_.end(); it != end;) {
mirror::Object* object = it->second;
if (!is_marked(object, arg)) {
weak_interns_.erase(it++);