Auto-generate operator<< for enum ::art:Class::Status.

This requires a bit more work in the script to support
enums nested inside classes.

Change-Id: Id0e3561c3675214f74f47ac9f36ba82c41fa775d
diff --git a/build/Android.common.mk b/build/Android.common.mk
index aeb4c79..bcac723 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -325,6 +325,7 @@
 	src/jdwp/jdwp.h \
 	src/jdwp/jdwp_constants.h \
 	src/mutex.h \
+	src/object.h \
 	src/thread.h \
 	src/verifier/method_verifier.h
 
diff --git a/src/object.cc b/src/object.cc
index e6dae74..6dda684 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -1569,25 +1569,4 @@
   return trace;
 }
 
-static const char* kClassStatusNames[] = {
-  "Error",
-  "NotReady",
-  "Idx",
-  "Loaded",
-  "Resolved",
-  "Verifying",
-  "RetryVerificationAtRuntime",
-  "Verified",
-  "Initializing",
-  "Initialized"
-};
-std::ostream& operator<<(std::ostream& os, const Class::Status& rhs) {
-  if (rhs >= Class::kStatusError && rhs <= Class::kStatusInitialized) {
-    os << kClassStatusNames[rhs + 1];
-  } else {
-    os << "Class::Status[" << static_cast<int>(rhs) << "]";
-  }
-  return os;
-}
-
 }  // namespace art
diff --git a/src/object.h b/src/object.h
index 7caabde..b6455db 100644
--- a/src/object.h
+++ b/src/object.h
@@ -109,7 +109,7 @@
 #if defined(ART_USE_LLVM_COMPILER)
 namespace compiler_llvm {
   class InferredRegCategoryMap;
-}
+} // namespace compiler_llvm
 #endif
 
 static const uint32_t kAccPublic = 0x0001;  // class, field, method, ic
@@ -1136,7 +1136,8 @@
 // provides the static storage. However, this might change to an Array
 // to improve image sharing, so we use this type to avoid assumptions
 // on the current storage.
-class MANAGED StaticStorageBase : public Object {};
+class MANAGED StaticStorageBase : public Object {
+};
 
 // C++ mirror of java.lang.Class
 class MANAGED Class : public StaticStorageBase {
@@ -2561,8 +2562,7 @@
   }
 
  private:
-
-  enum ArrayIndex {
+  enum {
     // Points to the interface class.
     kInterface   = 0,
     // Method pointers into the vtable, allow fast map from interface
diff --git a/tools/generate-operator-out.py b/tools/generate-operator-out.py
index ba2b4d1..23d6d3e 100755
--- a/tools/generate-operator-out.py
+++ b/tools/generate-operator-out.py
@@ -45,6 +45,7 @@
 
 def Confused(filename, line_number, line):
   sys.stderr.write('%s:%d: confused by:\n%s\n' % (filename, line_number, line))
+  raise Exception("giving up!")
   sys.exit(1)
 
 
@@ -83,7 +84,7 @@
         continue
 
       # Is this the start or end of an enclosing class or struct?
-      m = re.compile(r'^(?:class|struct) (\S+) \{').search(raw_line)
+      m = re.compile(r'^(?:class|struct)(?: MANAGED)? (\S+).* \{').search(raw_line)
       if m:
         enclosing_classes.append(m.group(1))
         continue
@@ -102,8 +103,13 @@
       in_enum = False
       continue
 
-    # Whitespace?
-    line = raw_line.strip()
+    # Strip // comments.
+    line = re.sub(r'//.*', '', raw_line)
+
+    # Strip whitespace.
+    line = line.strip()
+
+    # Skip blank lines.
     if len(line) == 0:
       continue