Clean up generated operator<<(os, enum).
Pass enums by value instead of const reference.
Do not generate operator<< sources for headers that have no
enums or no declarations of operator<<. Do not define the
operator<< for flag enums; these were unused anyway.
Add generated operator<< for some enums in nodes.h . Change
the operator<< for ComparisonBias so that the graph
visualizer can use it but do not use the generated
operator<< yet as that would require changing checker tests.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: Ifd4c455c2fa921a9668c966a13068d43b9c6e173
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 31e92d9..3cf255c 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -484,15 +484,12 @@
srcs: [
"base/callee_save_type.h",
"base/locks.h",
- "class_loader_context.h",
"class_status.h",
- "debugger.h",
"gc_root.h",
"gc/allocator_type.h",
"gc/allocator/rosalloc.h",
"gc/collector_type.h",
"gc/collector/gc_type.h",
- "gc/heap.h",
"gc/space/region_space.h",
"gc/space/space.h",
"gc/weak_root_state.h",
@@ -503,14 +500,12 @@
"jni_id_type.h",
"lock_word.h",
"oat_file.h",
- "object_callbacks.h",
"process_state.h",
"reflective_value_visitor.h",
"stack.h",
"suspend_reason.h",
"thread.h",
"thread_state.h",
- "ti/agent.h",
"trace.h",
"verifier/verifier_enums.h",
],
diff --git a/runtime/base/callee_save_type.h b/runtime/base/callee_save_type.h
index e7cc7e6..fcafe9c 100644
--- a/runtime/base/callee_save_type.h
+++ b/runtime/base/callee_save_type.h
@@ -32,7 +32,7 @@
kSaveEverythingForSuspendCheck, // Special kSaveEverything for suspend check.
kLastCalleeSaveType // Value used for iteration.
};
-std::ostream& operator<<(std::ostream& os, const CalleeSaveType& rhs);
+std::ostream& operator<<(std::ostream& os, CalleeSaveType rhs);
static inline constexpr CalleeSaveType GetCanonicalCalleeSaveType(CalleeSaveType type) {
if (type == CalleeSaveType::kSaveEverythingForClinit ||
diff --git a/runtime/base/locks.h b/runtime/base/locks.h
index c1667f3..7008539 100644
--- a/runtime/base/locks.h
+++ b/runtime/base/locks.h
@@ -150,7 +150,7 @@
kLockLevelCount // Must come last.
};
-std::ostream& operator<<(std::ostream& os, const LockLevel& rhs);
+std::ostream& operator<<(std::ostream& os, LockLevel rhs);
// For StartNoThreadSuspension and EndNoThreadSuspension.
class CAPABILITY("role") Role {
diff --git a/runtime/class_status.h b/runtime/class_status.h
index b194ffa..6c686a4 100644
--- a/runtime/class_status.h
+++ b/runtime/class_status.h
@@ -99,7 +99,7 @@
kLast = kVisiblyInitialized
};
-std::ostream& operator<<(std::ostream& os, const ClassStatus& rhs);
+std::ostream& operator<<(std::ostream& os, ClassStatus rhs);
} // namespace art
diff --git a/runtime/gc/allocator/rosalloc.h b/runtime/gc/allocator/rosalloc.h
index c4bc76f..48e3576 100644
--- a/runtime/gc/allocator/rosalloc.h
+++ b/runtime/gc/allocator/rosalloc.h
@@ -936,11 +936,11 @@
REQUIRES(Locks::mutator_lock_) REQUIRES(!lock_) REQUIRES(!bulk_free_lock_);
private:
- friend std::ostream& operator<<(std::ostream& os, const RosAlloc::PageMapKind& rhs);
+ friend std::ostream& operator<<(std::ostream& os, RosAlloc::PageMapKind rhs);
DISALLOW_COPY_AND_ASSIGN(RosAlloc);
};
-std::ostream& operator<<(std::ostream& os, const RosAlloc::PageMapKind& rhs);
+std::ostream& operator<<(std::ostream& os, RosAlloc::PageMapKind rhs);
// Callback from rosalloc when it needs to increase the footprint. Must be implemented somewhere
// else (currently rosalloc_space.cc).
diff --git a/runtime/gc/allocator_type.h b/runtime/gc/allocator_type.h
index cd9f5d4..fb29837 100644
--- a/runtime/gc/allocator_type.h
+++ b/runtime/gc/allocator_type.h
@@ -37,7 +37,7 @@
kAllocatorTypeRegion, // Use CAS-based contiguous bump-pointer allocation within a region. (*)
kAllocatorTypeRegionTLAB, // Use region pieces as TLABs. Default for most small objects. (*)
};
-std::ostream& operator<<(std::ostream& os, const AllocatorType& rhs);
+std::ostream& operator<<(std::ostream& os, AllocatorType rhs);
inline constexpr bool IsTLABAllocator(AllocatorType allocator) {
return allocator == kAllocatorTypeTLAB || allocator == kAllocatorTypeRegionTLAB;
diff --git a/runtime/gc/collector/gc_type.h b/runtime/gc/collector/gc_type.h
index 401444a..f03ba1f 100644
--- a/runtime/gc/collector/gc_type.h
+++ b/runtime/gc/collector/gc_type.h
@@ -37,7 +37,7 @@
// Number of different GC types.
kGcTypeMax,
};
-std::ostream& operator<<(std::ostream& os, const GcType& policy);
+std::ostream& operator<<(std::ostream& os, GcType policy);
} // namespace collector
} // namespace gc
diff --git a/runtime/gc/collector_type.h b/runtime/gc/collector_type.h
index 62527e2..9c99964 100644
--- a/runtime/gc/collector_type.h
+++ b/runtime/gc/collector_type.h
@@ -60,7 +60,7 @@
// Fake collector type for ScopedGCCriticalSection
kCollectorTypeCriticalSection,
};
-std::ostream& operator<<(std::ostream& os, const CollectorType& collector_type);
+std::ostream& operator<<(std::ostream& os, CollectorType collector_type);
static constexpr CollectorType kCollectorTypeDefault =
#if ART_DEFAULT_GC_TYPE_IS_CMS
diff --git a/runtime/gc/space/region_space.h b/runtime/gc/space/region_space.h
index 9a3ce94..3da303d 100644
--- a/runtime/gc/space/region_space.h
+++ b/runtime/gc/space/region_space.h
@@ -782,8 +782,8 @@
DISALLOW_COPY_AND_ASSIGN(RegionSpace);
};
-std::ostream& operator<<(std::ostream& os, const RegionSpace::RegionState& value);
-std::ostream& operator<<(std::ostream& os, const RegionSpace::RegionType& value);
+std::ostream& operator<<(std::ostream& os, RegionSpace::RegionState value);
+std::ostream& operator<<(std::ostream& os, RegionSpace::RegionType value);
} // namespace space
} // namespace gc
diff --git a/runtime/gc/space/space.h b/runtime/gc/space/space.h
index 3b7e3b7..5ea97eb 100644
--- a/runtime/gc/space/space.h
+++ b/runtime/gc/space/space.h
@@ -64,7 +64,7 @@
// collections won't scan these areas such as the Zygote.
kGcRetentionPolicyFullCollect,
};
-std::ostream& operator<<(std::ostream& os, const GcRetentionPolicy& policy);
+std::ostream& operator<<(std::ostream& os, GcRetentionPolicy policy);
enum SpaceType {
kSpaceTypeImageSpace,
@@ -74,7 +74,7 @@
kSpaceTypeLargeObjectSpace,
kSpaceTypeRegionSpace,
};
-std::ostream& operator<<(std::ostream& os, const SpaceType& space_type);
+std::ostream& operator<<(std::ostream& os, SpaceType space_type);
// A space contains memory allocated for managed objects.
class Space {
diff --git a/runtime/gc/weak_root_state.h b/runtime/gc/weak_root_state.h
index e3cefc4..0784d3c 100644
--- a/runtime/gc/weak_root_state.h
+++ b/runtime/gc/weak_root_state.h
@@ -33,7 +33,7 @@
kWeakRootStateMarkNewRoots,
};
-std::ostream& operator<<(std::ostream& os, const WeakRootState&);
+std::ostream& operator<<(std::ostream& os, WeakRootState weak_root_state);
} // namespace gc
} // namespace art
diff --git a/runtime/gc_root.h b/runtime/gc_root.h
index 8d8c32c..553f3d6 100644
--- a/runtime/gc_root.h
+++ b/runtime/gc_root.h
@@ -54,7 +54,7 @@
kRootVMInternal,
kRootJNIMonitor,
};
-std::ostream& operator<<(std::ostream& os, const RootType& root_type);
+std::ostream& operator<<(std::ostream& os, RootType root_type);
// Only used by hprof. thread_id_ and type_ are only used by hprof.
class RootInfo {
diff --git a/runtime/image.h b/runtime/image.h
index 637bf1c..ca585e7 100644
--- a/runtime/image.h
+++ b/runtime/image.h
@@ -579,11 +579,12 @@
return val & ~3u;
}
-std::ostream& operator<<(std::ostream& os, const ImageHeader::ImageMethod& method);
-std::ostream& operator<<(std::ostream& os, const ImageHeader::ImageRoot& root);
-std::ostream& operator<<(std::ostream& os, const ImageHeader::ImageSections& section);
+std::ostream& operator<<(std::ostream& os, ImageHeader::ImageMethod method);
+std::ostream& operator<<(std::ostream& os, ImageHeader::ImageRoot root);
+std::ostream& operator<<(std::ostream& os, ImageHeader::ImageSections section);
+std::ostream& operator<<(std::ostream& os, ImageHeader::StorageMode mode);
+
std::ostream& operator<<(std::ostream& os, const ImageSection& section);
-std::ostream& operator<<(std::ostream& os, const ImageHeader::StorageMode& mode);
} // namespace art
diff --git a/runtime/indirect_reference_table.h b/runtime/indirect_reference_table.h
index eb07035..b46435d 100644
--- a/runtime/indirect_reference_table.h
+++ b/runtime/indirect_reference_table.h
@@ -97,7 +97,7 @@
kWeakGlobal = 3, // <<weak global reference>>
kLastKind = kWeakGlobal
};
-std::ostream& operator<<(std::ostream& os, const IndirectRefKind& rhs);
+std::ostream& operator<<(std::ostream& os, IndirectRefKind rhs);
const char* GetIndirectRefKindString(const IndirectRefKind& kind);
// Table definition.
diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h
index e30fc9a..6c08333 100644
--- a/runtime/instrumentation.h
+++ b/runtime/instrumentation.h
@@ -763,8 +763,8 @@
DISALLOW_COPY_AND_ASSIGN(Instrumentation);
};
-std::ostream& operator<<(std::ostream& os, const Instrumentation::InstrumentationEvent& rhs);
-std::ostream& operator<<(std::ostream& os, const Instrumentation::InstrumentationLevel& rhs);
+std::ostream& operator<<(std::ostream& os, Instrumentation::InstrumentationEvent rhs);
+std::ostream& operator<<(std::ostream& os, Instrumentation::InstrumentationLevel rhs);
// An element in the instrumentation side stack maintained in art::Thread.
struct InstrumentationStackFrame {
diff --git a/runtime/jdwp_provider.h b/runtime/jdwp_provider.h
index 9cd3145..c7711ec 100644
--- a/runtime/jdwp_provider.h
+++ b/runtime/jdwp_provider.h
@@ -51,7 +51,7 @@
return JdwpProvider::kUnsetNonDebuggable;
}
-std::ostream& operator<<(std::ostream& os, const JdwpProvider& rhs);
+std::ostream& operator<<(std::ostream& os, JdwpProvider rhs);
} // namespace art
#endif // ART_RUNTIME_JDWP_PROVIDER_H_
diff --git a/runtime/jni_id_type.h b/runtime/jni_id_type.h
index 3f952b6..a8908fc 100644
--- a/runtime/jni_id_type.h
+++ b/runtime/jni_id_type.h
@@ -35,7 +35,7 @@
kDefault = kPointer,
};
-std::ostream& operator<<(std::ostream& os, const JniIdType& rhs);
+std::ostream& operator<<(std::ostream& os, JniIdType rhs);
} // namespace art
#endif // ART_RUNTIME_JNI_ID_TYPE_H_
diff --git a/runtime/lock_word.h b/runtime/lock_word.h
index 30559a0..84f45c2 100644
--- a/runtime/lock_word.h
+++ b/runtime/lock_word.h
@@ -316,7 +316,7 @@
// The encoded value holding all the state.
uint32_t value_;
};
-std::ostream& operator<<(std::ostream& os, const LockWord::LockState& code);
+std::ostream& operator<<(std::ostream& os, LockWord::LockState code);
} // namespace art
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index ee5aede..c1f15dd 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -70,7 +70,7 @@
kOatClassMax = 3,
};
-std::ostream& operator<<(std::ostream& os, const OatClassType& rhs);
+std::ostream& operator<<(std::ostream& os, OatClassType rhs);
class PACKED(4) OatMethodOffsets {
public:
diff --git a/runtime/process_state.h b/runtime/process_state.h
index e8797d6..aee200a 100644
--- a/runtime/process_state.h
+++ b/runtime/process_state.h
@@ -26,7 +26,7 @@
kProcessStateJankImperceptible = 1,
};
-std::ostream& operator<<(std::ostream& os, const ProcessState& process_state);
+std::ostream& operator<<(std::ostream& os, ProcessState process_state);
} // namespace art
diff --git a/runtime/reflective_value_visitor.h b/runtime/reflective_value_visitor.h
index 3a72760..87c5fe7 100644
--- a/runtime/reflective_value_visitor.h
+++ b/runtime/reflective_value_visitor.h
@@ -98,7 +98,7 @@
kSourceDexCacheResolvedField,
kSourceMiscInternal,
};
-std::ostream& operator<<(std::ostream& os, const ReflectionSourceType& type);
+std::ostream& operator<<(std::ostream& os, ReflectionSourceType type);
class ReflectionSourceInfo : public ValueObject {
public:
diff --git a/runtime/stack.h b/runtime/stack.h
index af33e6c..a7d9d53 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -54,7 +54,7 @@
kImpreciseConstant,
kUndefined,
};
-std::ostream& operator<<(std::ostream& os, const VRegKind& rhs);
+std::ostream& operator<<(std::ostream& os, VRegKind rhs);
// Size in bytes of the should_deoptimize flag on stack.
// We just need 4 bytes for our purpose regardless of the architecture. Frame size
diff --git a/runtime/suspend_reason.h b/runtime/suspend_reason.h
index 7f377d5..f45505a 100644
--- a/runtime/suspend_reason.h
+++ b/runtime/suspend_reason.h
@@ -30,7 +30,7 @@
kForUserCode,
};
-std::ostream& operator<<(std::ostream& os, const SuspendReason& thread);
+std::ostream& operator<<(std::ostream& os, SuspendReason thread);
} // namespace art
diff --git a/runtime/thread.h b/runtime/thread.h
index 5742689..d2833b0 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -2027,7 +2027,7 @@
};
std::ostream& operator<<(std::ostream& os, const Thread& thread);
-std::ostream& operator<<(std::ostream& os, const StackedShadowFrameType& thread);
+std::ostream& operator<<(std::ostream& os, StackedShadowFrameType thread);
} // namespace art
diff --git a/runtime/thread_state.h b/runtime/thread_state.h
index f36bc80..69b5b5d 100644
--- a/runtime/thread_state.h
+++ b/runtime/thread_state.h
@@ -57,7 +57,7 @@
kNative, // RUNNABLE TS_RUNNING running in a JNI native method
kSuspended, // RUNNABLE TS_RUNNING suspended by GC or debugger
};
-std::ostream& operator<<(std::ostream& os, const ThreadState& rhs);
+std::ostream& operator<<(std::ostream& os, ThreadState rhs);
} // namespace art
diff --git a/runtime/trace.h b/runtime/trace.h
index eccf157..25bff51 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -57,7 +57,7 @@
kMethodTracingActive, // Trace activity synchronous with method progress.
kSampleProfilingActive, // Trace activity captured by sampling thread.
};
-std::ostream& operator<<(std::ostream& os, const TracingMode& rhs);
+std::ostream& operator<<(std::ostream& os, TracingMode rhs);
// File format:
// header
diff --git a/runtime/verifier/verifier_enums.h b/runtime/verifier/verifier_enums.h
index 33eca4d..e3420f0 100644
--- a/runtime/verifier/verifier_enums.h
+++ b/runtime/verifier/verifier_enums.h
@@ -36,7 +36,7 @@
kSoftFailure,
kHardFailure,
};
-std::ostream& operator<<(std::ostream& os, const FailureKind& rhs);
+std::ostream& operator<<(std::ostream& os, FailureKind rhs);
// How to log hard failures during verification.
enum class HardFailLogMode {
@@ -62,7 +62,7 @@
METHOD_INTERFACE, // interface
METHOD_POLYMORPHIC // polymorphic
};
-std::ostream& operator<<(std::ostream& os, const MethodType& rhs);
+std::ostream& operator<<(std::ostream& os, MethodType rhs);
/*
* An enumeration of problems that can turn up during verification.
@@ -101,7 +101,7 @@
// code. May be removed once the compiler handles
// unreachable code correctly.
};
-std::ostream& operator<<(std::ostream& os, const VerifyError& rhs);
+std::ostream& operator<<(std::ostream& os, VerifyError rhs);
} // namespace verifier
} // namespace art