diff options
author | 2019-01-07 15:20:12 -0800 | |
---|---|---|
committer | 2019-01-09 12:38:30 -0800 | |
commit | 8764dc3b3eda7f6f13ed7b584475503fe5bedd59 (patch) | |
tree | e8f6e3a4a2596595ffdc8a517daaf37030482eae | |
parent | 49b74a8c685acfe43dd33e3f51a24c486388bee1 (diff) |
ART: Use iosfwd more
Use iosfwd where an include of ostream is unnecessary. Also move
callee_save_type.h to runtime.
Bug: 119869270
Test: mmma art
Change-Id: Id8995d6f524e4c491eb6f57fdffb940cf35d291f
-rw-r--r-- | libartbase/Android.bp | 2 | ||||
-rw-r--r-- | libartbase/base/enums.cc | 32 | ||||
-rw-r--r-- | libartbase/base/enums.h | 11 | ||||
-rw-r--r-- | libartbase/base/logging.h | 3 | ||||
-rw-r--r-- | libdexfile/dex/dex_file.cc | 1 | ||||
-rw-r--r-- | libdexfile/dex/dex_file_types.h | 3 | ||||
-rw-r--r-- | runtime/Android.bp | 1 | ||||
-rw-r--r-- | runtime/arch/instruction_set_features.cc | 3 | ||||
-rw-r--r-- | runtime/arch/instruction_set_features.h | 2 | ||||
-rw-r--r-- | runtime/base/callee_save_type.h (renamed from libartbase/base/callee_save_type.h) | 10 | ||||
-rw-r--r-- | runtime/compiler_filter.cc | 2 | ||||
-rw-r--r-- | runtime/compiler_filter.h | 2 | ||||
-rw-r--r-- | runtime/gc/space/malloc_space.cc | 2 | ||||
-rw-r--r-- | runtime/gc/space/malloc_space.h | 3 | ||||
-rw-r--r-- | runtime/obj_ptr-inl.h | 2 | ||||
-rw-r--r-- | runtime/obj_ptr.h | 2 | ||||
-rw-r--r-- | runtime/offsets.h | 2 | ||||
-rw-r--r-- | runtime/suspend_reason.h | 2 | ||||
-rw-r--r-- | runtime/thread_state.h | 2 |
19 files changed, 61 insertions, 26 deletions
diff --git a/libartbase/Android.bp b/libartbase/Android.bp index 109853ca6a..509b0728fa 100644 --- a/libartbase/Android.bp +++ b/libartbase/Android.bp @@ -24,6 +24,7 @@ cc_defaults { "base/arena_allocator.cc", "base/arena_bit_vector.cc", "base/bit_vector.cc", + "base/enums.cc", "base/file_magic.cc", "base/file_utils.cc", "base/hex_dump.cc", @@ -153,7 +154,6 @@ gensrcs { srcs: [ "arch/instruction_set.h", "base/allocator.h", - "base/callee_save_type.h", "base/unix_file/fd_file.h", ], output_extension: "operator_out.cc", diff --git a/libartbase/base/enums.cc b/libartbase/base/enums.cc new file mode 100644 index 0000000000..3f28232b41 --- /dev/null +++ b/libartbase/base/enums.cc @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2016 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. + */ + +#include "enums.h" + +#include <ostream> + +namespace art { + +std::ostream& operator<<(std::ostream& os, const PointerSize& rhs) { + switch (rhs) { + case PointerSize::k32: os << "k32"; break; + case PointerSize::k64: os << "k64"; break; + default: os << "PointerSize[" << static_cast<int>(rhs) << "]"; break; + } + return os; +} + +} // namespace art diff --git a/libartbase/base/enums.h b/libartbase/base/enums.h index ad5578fc81..c5fb880ba5 100644 --- a/libartbase/base/enums.h +++ b/libartbase/base/enums.h @@ -18,7 +18,7 @@ #define ART_LIBARTBASE_BASE_ENUMS_H_ #include <cstddef> -#include <ostream> +#include <iosfwd> namespace art { @@ -27,14 +27,7 @@ enum class PointerSize : size_t { k64 = 8 }; -inline std::ostream& operator<<(std::ostream& os, const PointerSize& rhs) { - switch (rhs) { - case PointerSize::k32: os << "k32"; break; - case PointerSize::k64: os << "k64"; break; - default: os << "PointerSize[" << static_cast<int>(rhs) << "]"; break; - } - return os; -} +std::ostream& operator<<(std::ostream& os, const PointerSize& rhs); static constexpr PointerSize kRuntimePointerSize = sizeof(void*) == 8U ? PointerSize::k64 diff --git a/libartbase/base/logging.h b/libartbase/base/logging.h index 9ded082130..484db87b9a 100644 --- a/libartbase/base/logging.h +++ b/libartbase/base/logging.h @@ -17,9 +17,6 @@ #ifndef ART_LIBARTBASE_BASE_LOGGING_H_ #define ART_LIBARTBASE_BASE_LOGGING_H_ -#include <ostream> -#include <sstream> - #include "android-base/logging.h" #include "macros.h" diff --git a/libdexfile/dex/dex_file.cc b/libdexfile/dex/dex_file.cc index 5c100e6005..d3cdf13ec6 100644 --- a/libdexfile/dex/dex_file.cc +++ b/libdexfile/dex/dex_file.cc @@ -23,6 +23,7 @@ #include <zlib.h> #include <memory> +#include <ostream> #include <sstream> #include <type_traits> diff --git a/libdexfile/dex/dex_file_types.h b/libdexfile/dex/dex_file_types.h index d4fb3de504..ecc048219d 100644 --- a/libdexfile/dex/dex_file_types.h +++ b/libdexfile/dex/dex_file_types.h @@ -17,8 +17,9 @@ #ifndef ART_LIBDEXFILE_DEX_DEX_FILE_TYPES_H_ #define ART_LIBDEXFILE_DEX_DEX_FILE_TYPES_H_ +#include <iosfwd> #include <limits> -#include <ostream> +#include <utility> namespace art { namespace dex { diff --git a/runtime/Android.bp b/runtime/Android.bp index 71c5b74363..b89eb02ff0 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -462,6 +462,7 @@ gensrcs { cmd: "$(location generate_operator_out) art/runtime $(in) > $(out)", tools: ["generate_operator_out"], srcs: [ + "base/callee_save_type.h", "base/locks.h", "class_loader_context.h", "class_status.h", diff --git a/runtime/arch/instruction_set_features.cc b/runtime/arch/instruction_set_features.cc index 0c45bc9197..886b40af30 100644 --- a/runtime/arch/instruction_set_features.cc +++ b/runtime/arch/instruction_set_features.cc @@ -16,6 +16,9 @@ #include "instruction_set_features.h" +#include <algorithm> +#include <ostream> + #include "android-base/strings.h" #include "base/casts.h" diff --git a/runtime/arch/instruction_set_features.h b/runtime/arch/instruction_set_features.h index c31c927668..f910a4183d 100644 --- a/runtime/arch/instruction_set_features.h +++ b/runtime/arch/instruction_set_features.h @@ -17,8 +17,8 @@ #ifndef ART_RUNTIME_ARCH_INSTRUCTION_SET_FEATURES_H_ #define ART_RUNTIME_ARCH_INSTRUCTION_SET_FEATURES_H_ +#include <iosfwd> #include <memory> -#include <ostream> #include <vector> #include "arch/instruction_set.h" diff --git a/libartbase/base/callee_save_type.h b/runtime/base/callee_save_type.h index 3e44a3a73f..e7cc7e6092 100644 --- a/libartbase/base/callee_save_type.h +++ b/runtime/base/callee_save_type.h @@ -14,11 +14,11 @@ * limitations under the License. */ -#ifndef ART_LIBARTBASE_BASE_CALLEE_SAVE_TYPE_H_ -#define ART_LIBARTBASE_BASE_CALLEE_SAVE_TYPE_H_ +#ifndef ART_RUNTIME_BASE_CALLEE_SAVE_TYPE_H_ +#define ART_RUNTIME_BASE_CALLEE_SAVE_TYPE_H_ -#include <cstddef> -#include <ostream> +#include <cstdint> +#include <iosfwd> namespace art { @@ -44,4 +44,4 @@ static inline constexpr CalleeSaveType GetCanonicalCalleeSaveType(CalleeSaveType } // namespace art -#endif // ART_LIBARTBASE_BASE_CALLEE_SAVE_TYPE_H_ +#endif // ART_RUNTIME_BASE_CALLEE_SAVE_TYPE_H_ diff --git a/runtime/compiler_filter.cc b/runtime/compiler_filter.cc index bda64ebf25..c0864901cf 100644 --- a/runtime/compiler_filter.cc +++ b/runtime/compiler_filter.cc @@ -16,6 +16,8 @@ #include "compiler_filter.h" +#include <ostream> + #include "base/utils.h" namespace art { diff --git a/runtime/compiler_filter.h b/runtime/compiler_filter.h index 012ebcbe1c..c36e40fc0a 100644 --- a/runtime/compiler_filter.h +++ b/runtime/compiler_filter.h @@ -17,7 +17,7 @@ #ifndef ART_RUNTIME_COMPILER_FILTER_H_ #define ART_RUNTIME_COMPILER_FILTER_H_ -#include <ostream> +#include <iosfwd> #include <string> #include <vector> diff --git a/runtime/gc/space/malloc_space.cc b/runtime/gc/space/malloc_space.cc index b5e6b62bcd..474231bb40 100644 --- a/runtime/gc/space/malloc_space.cc +++ b/runtime/gc/space/malloc_space.cc @@ -16,6 +16,8 @@ #include "malloc_space.h" +#include <ostream> + #include "android-base/stringprintf.h" #include "base/logging.h" // For VLOG diff --git a/runtime/gc/space/malloc_space.h b/runtime/gc/space/malloc_space.h index 7d28516961..9a90dfd2ac 100644 --- a/runtime/gc/space/malloc_space.h +++ b/runtime/gc/space/malloc_space.h @@ -19,7 +19,8 @@ #include "space.h" -#include <ostream> +#include <iosfwd> + #include "base/memory_tool.h" #include "base/mutex.h" diff --git a/runtime/obj_ptr-inl.h b/runtime/obj_ptr-inl.h index b949c96dd2..f096445913 100644 --- a/runtime/obj_ptr-inl.h +++ b/runtime/obj_ptr-inl.h @@ -17,6 +17,8 @@ #ifndef ART_RUNTIME_OBJ_PTR_INL_H_ #define ART_RUNTIME_OBJ_PTR_INL_H_ +#include <ostream> + #include "base/bit_utils.h" #include "obj_ptr.h" #include "thread-current-inl.h" diff --git a/runtime/obj_ptr.h b/runtime/obj_ptr.h index 73a99abd54..b0f24dabc8 100644 --- a/runtime/obj_ptr.h +++ b/runtime/obj_ptr.h @@ -17,7 +17,7 @@ #ifndef ART_RUNTIME_OBJ_PTR_H_ #define ART_RUNTIME_OBJ_PTR_H_ -#include <ostream> +#include <iosfwd> #include <type_traits> #include "base/locks.h" // For Locks::mutator_lock_. diff --git a/runtime/offsets.h b/runtime/offsets.h index d4c0dd645c..6d1a8e0ed6 100644 --- a/runtime/offsets.h +++ b/runtime/offsets.h @@ -17,7 +17,7 @@ #ifndef ART_RUNTIME_OFFSETS_H_ #define ART_RUNTIME_OFFSETS_H_ -#include <ostream> +#include <iosfwd> #include "base/enums.h" #include "runtime_globals.h" diff --git a/runtime/suspend_reason.h b/runtime/suspend_reason.h index 289a1a4fb3..af2be10dfd 100644 --- a/runtime/suspend_reason.h +++ b/runtime/suspend_reason.h @@ -17,7 +17,7 @@ #ifndef ART_RUNTIME_SUSPEND_REASON_H_ #define ART_RUNTIME_SUSPEND_REASON_H_ -#include <ostream> +#include <iosfwd> namespace art { diff --git a/runtime/thread_state.h b/runtime/thread_state.h index 8edfeecbdd..e57a040cb1 100644 --- a/runtime/thread_state.h +++ b/runtime/thread_state.h @@ -17,7 +17,7 @@ #ifndef ART_RUNTIME_THREAD_STATE_H_ #define ART_RUNTIME_THREAD_STATE_H_ -#include <ostream> +#include <iosfwd> namespace art { |