Start automatically generating operator<<s for enums.
Change-Id: I0f53db089b9a1ba38ce82b75ab22448877be67e0
diff --git a/src/constants.cc b/src/constants.cc
deleted file mode 100644
index 12632eb..0000000
--- a/src/constants.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// TODO: automatically generate operator<<s for enum types.
-
-#include <iostream>
-
-#include "instruction_set.h"
-#include "invoke_type.h"
-
-namespace art {
-
-std::ostream& operator<<(std::ostream& os, const InstructionSet& rhs) {
- switch (rhs) {
- case kNone: os << "none"; break;
- case kArm: os << "ARM"; break;
- case kThumb2: os << "Thumb2"; break;
- case kX86: os << "x86"; break;
- case kMips: os << "MIPS"; break;
- default: os << "InstructionSet[" << static_cast<int>(rhs) << "]"; break;
- }
- return os;
-}
-
-std::ostream& operator<<(std::ostream& os, const InvokeType& rhs) {
- switch (rhs) {
- case kStatic: os << "static"; break;
- case kDirect: os << "direct"; break;
- case kVirtual: os << "virtual"; break;
- case kSuper: os << "super"; break;
- case kInterface: os << "interface"; break;
- default: os << "InvokeType[" << static_cast<int>(rhs) << "]"; break;
- }
- return os;
-}
-
-} // namespace art
diff --git a/src/indirect_reference_table.cc b/src/indirect_reference_table.cc
index ac5e402..14d804b 100644
--- a/src/indirect_reference_table.cc
+++ b/src/indirect_reference_table.cc
@@ -329,27 +329,6 @@
}
}
-std::ostream& operator<<(std::ostream& os, IndirectRefKind rhs) {
- switch (rhs) {
- case kSirtOrInvalid:
- os << "stack indirect reference table or invalid reference";
- break;
- case kLocal:
- os << "local reference";
- break;
- case kGlobal:
- os << "global reference";
- break;
- case kWeakGlobal:
- os << "weak global reference";
- break;
- default:
- os << "IndirectRefKind[" << static_cast<int>(rhs) << "]";
- break;
- }
- return os;
-}
-
void IndirectReferenceTable::Dump() const {
LOG(WARNING) << kind_ << " table dump:";
std::vector<const Object*> entries(table_, table_ + Capacity());
diff --git a/src/indirect_reference_table.h b/src/indirect_reference_table.h
index b1f6d8c..b0a0d64 100644
--- a/src/indirect_reference_table.h
+++ b/src/indirect_reference_table.h
@@ -106,12 +106,12 @@
* For convenience these match up with enum jobjectRefType from jni.h.
*/
enum IndirectRefKind {
- kSirtOrInvalid = 0,
- kLocal = 1,
- kGlobal = 2,
- kWeakGlobal = 3
+ kSirtOrInvalid = 0, // <<stack indirect reference table or invalid reference>>
+ kLocal = 1, // <<local reference>>
+ kGlobal = 2, // <<global reference>>
+ kWeakGlobal = 3 // <<weak global reference>>
};
-std::ostream& operator<<(std::ostream& os, IndirectRefKind rhs);
+std::ostream& operator<<(std::ostream& os, const IndirectRefKind& rhs);
/*
* Determine what kind of indirect reference this is.
diff --git a/src/invoke_type.h b/src/invoke_type.h
index f37f1b4..d724fdb 100644
--- a/src/invoke_type.h
+++ b/src/invoke_type.h
@@ -22,7 +22,11 @@
namespace art {
enum InvokeType {
- kStatic, kDirect, kVirtual, kSuper, kInterface,
+ kStatic, // <<static>>
+ kDirect, // <<direct>>
+ kVirtual, // <<virtual>>
+ kSuper, // <<super>>
+ kInterface, // <<interface>>
kMaxInvokeType = kInterface
};
diff --git a/src/jdwp/jdwp.h b/src/jdwp/jdwp.h
index d297f6f..7d8bf22 100644
--- a/src/jdwp/jdwp.h
+++ b/src/jdwp/jdwp.h
@@ -87,8 +87,8 @@
*/
enum JdwpTransportType {
kJdwpTransportUnknown = 0,
- kJdwpTransportSocket, /* transport=dt_socket */
- kJdwpTransportAndroidAdb, /* transport=dt_android_adb */
+ kJdwpTransportSocket, // transport=dt_socket
+ kJdwpTransportAndroidAdb, // transport=dt_android_adb
};
std::ostream& operator<<(std::ostream& os, const JdwpTransportType& rhs);
diff --git a/src/mutex.cc b/src/mutex.cc
index 1e30543..b0b82f3 100644
--- a/src/mutex.cc
+++ b/src/mutex.cc
@@ -194,14 +194,4 @@
}
}
-std::ostream& operator<<(std::ostream& os, const MutexRank& rhs) {
- switch (rhs) {
- case kHeapLock: os << "HeapLock"; break;
- case kThreadListLock: os << "ThreadListLock"; break;
- case kThreadSuspendCountLock: os << "ThreadSuspendCountLock"; break;
- default: os << "MutexRank[" << static_cast<int>(rhs) << "]"; break;
- }
- return os;
-}
-
} // namespace