diff options
author | Ian Rogers <irogers@google.com> | 2014-05-15 16:42:40 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2014-05-15 16:50:51 -0700 |
commit | 507dfdd147c97bfbadebfd63584d094b6a4e7b47 (patch) | |
tree | cce43931b6dcd088cb2932c2491f86116353a27f /runtime | |
parent | 922ddb30982d2597eab634d8b8598bec0eb7d3b7 (diff) | |
download | art-507dfdd147c97bfbadebfd63584d094b6a4e7b47.zip art-507dfdd147c97bfbadebfd63584d094b6a4e7b47.tar.gz art-507dfdd147c97bfbadebfd63584d094b6a4e7b47.tar.bz2 |
Compatibility layer to transition from UniquePtr to std::unique_ptr.
Use ART_WITH_STLPORT (enabled for the target) to cause the use of UniquePtr,
for the host switch to std::unique_ptr. For now the type remains called
UniquePtr.
Make dalvik compile with clang on the host, move its build to C++11.
Change-Id: I5ba8d2757904bc089ed62047ea03de3c0853fb12
Diffstat (limited to 'runtime')
51 files changed, 87 insertions, 50 deletions
diff --git a/runtime/UniquePtrCompat.h b/runtime/UniquePtrCompat.h new file mode 100644 index 0000000..4a45616 --- /dev/null +++ b/runtime/UniquePtrCompat.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 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. + */ + +#ifndef ART_RUNTIME_UNIQUEPTRCOMPAT_H_ +#define ART_RUNTIME_UNIQUEPTRCOMPAT_H_ + +// Stlport doesn't declare std::unique_ptr. UniquePtr.h declares an incompatible std::swap +// prototype with libc++. This compatibility header file resolves differences between the two, in +// the future UniquePtr will become std::unique_ptr. + +#ifdef ART_WITH_STLPORT + +#include "UniquePtr.h" + +#else // ART_WITH_STLPORT + +#include <memory> + +template <typename T> +using UniquePtr = typename std::unique_ptr<T>; + +#endif // ART_WITH_STLPORT + +#endif // ART_RUNTIME_UNIQUEPTRCOMPAT_H_ diff --git a/runtime/barrier.h b/runtime/barrier.h index 0c7fd87..d3e6bae 100644 --- a/runtime/barrier.h +++ b/runtime/barrier.h @@ -18,7 +18,7 @@ #define ART_RUNTIME_BARRIER_H_ #include "base/mutex.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/barrier_test.cc b/runtime/barrier_test.cc index 7d32338..a02c4c7 100644 --- a/runtime/barrier_test.cc +++ b/runtime/barrier_test.cc @@ -22,7 +22,7 @@ #include "common_runtime_test.h" #include "mirror/object_array-inl.h" #include "thread_pool.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { class CheckWaitTask : public Task { diff --git a/runtime/base/bit_vector_test.cc b/runtime/base/bit_vector_test.cc index 2ff55cb..990d1db 100644 --- a/runtime/base/bit_vector_test.cc +++ b/runtime/base/bit_vector_test.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "bit_vector.h" #include "gtest/gtest.h" diff --git a/runtime/base/histogram_test.cc b/runtime/base/histogram_test.cc index 966b97f..d72ae47 100644 --- a/runtime/base/histogram_test.cc +++ b/runtime/base/histogram_test.cc @@ -16,7 +16,7 @@ #include "gtest/gtest.h" #include "histogram-inl.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include <sstream> diff --git a/runtime/base/logging.cc b/runtime/base/logging.cc index 730a2c2..b6c6b9b 100644 --- a/runtime/base/logging.cc +++ b/runtime/base/logging.cc @@ -19,7 +19,7 @@ #include "base/mutex.h" #include "runtime.h" #include "thread-inl.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "utils.h" namespace art { diff --git a/runtime/base/logging.h b/runtime/base/logging.h index 6944278..7800cfe 100644 --- a/runtime/base/logging.h +++ b/runtime/base/logging.h @@ -25,7 +25,7 @@ #include <vector> #include "base/macros.h" #include "log_severity.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #define CHECK(x) \ if (UNLIKELY(!(x))) \ diff --git a/runtime/base/unix_file/random_access_file_test.h b/runtime/base/unix_file/random_access_file_test.h index 8a6605e..67e8c22 100644 --- a/runtime/base/unix_file/random_access_file_test.h +++ b/runtime/base/unix_file/random_access_file_test.h @@ -22,7 +22,7 @@ #include <string> #include "common_runtime_test.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace unix_file { diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 9034560..c7f3a20 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -62,7 +62,7 @@ #include "scoped_thread_state_change.h" #include "handle_scope-inl.h" #include "thread.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "utils.h" #include "verifier/method_verifier.h" #include "well_known_classes.h" diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc index 0db08aa..9970dd5 100644 --- a/runtime/class_linker_test.cc +++ b/runtime/class_linker_test.cc @@ -18,7 +18,7 @@ #include <string> -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "class_linker-inl.h" #include "common_runtime_test.h" #include "dex_file.h" diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h index 79d3690..d7a1667 100644 --- a/runtime/common_runtime_test.h +++ b/runtime/common_runtime_test.h @@ -47,7 +47,7 @@ #include "ScopedLocalRef.h" #include "thread.h" #include "utils.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "verifier/method_verifier.h" #include "verifier/method_verifier-inl.h" #include "well_known_classes.h" diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index f3d4621..26b7d07 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -39,7 +39,7 @@ #include "ScopedFd.h" #include "handle_scope-inl.h" #include "thread.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "utf-inl.h" #include "utils.h" #include "well_known_classes.h" diff --git a/runtime/dex_file.h b/runtime/dex_file.h index cfa2555..0146f31 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -28,7 +28,7 @@ #include "mem_map.h" #include "modifiers.h" #include "safe_map.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/dex_file_test.cc b/runtime/dex_file_test.cc index 9b6859a..86c282e 100644 --- a/runtime/dex_file_test.cc +++ b/runtime/dex_file_test.cc @@ -16,7 +16,7 @@ #include "dex_file.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "common_runtime_test.h" namespace art { diff --git a/runtime/dex_file_verifier.cc b/runtime/dex_file_verifier.cc index 528e112..d179c8b 100644 --- a/runtime/dex_file_verifier.cc +++ b/runtime/dex_file_verifier.cc @@ -22,7 +22,7 @@ #include "dex_file-inl.h" #include "leb128.h" #include "safe_map.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "utf-inl.h" #include "utils.h" diff --git a/runtime/dex_instruction_visitor_test.cc b/runtime/dex_instruction_visitor_test.cc index 8f42b0c..99ad3ed 100644 --- a/runtime/dex_instruction_visitor_test.cc +++ b/runtime/dex_instruction_visitor_test.cc @@ -18,7 +18,7 @@ #include <iostream> -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "gtest/gtest.h" namespace art { diff --git a/runtime/elf_file.h b/runtime/elf_file.h index d2a044e..138147b 100644 --- a/runtime/elf_file.h +++ b/runtime/elf_file.h @@ -25,7 +25,7 @@ #include "elf_utils.h" #include "mem_map.h" #include "os.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/exception_test.cc b/runtime/exception_test.cc index 91a0176..37ad9e5 100644 --- a/runtime/exception_test.cc +++ b/runtime/exception_test.cc @@ -27,7 +27,7 @@ #include "scoped_thread_state_change.h" #include "handle_scope-inl.h" #include "thread.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "vmap_table.h" namespace art { diff --git a/runtime/gc/accounting/atomic_stack.h b/runtime/gc/accounting/atomic_stack.h index c79b586..7d8b584 100644 --- a/runtime/gc/accounting/atomic_stack.h +++ b/runtime/gc/accounting/atomic_stack.h @@ -23,7 +23,7 @@ #include "atomic.h" #include "base/logging.h" #include "base/macros.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "mem_map.h" #include "utils.h" diff --git a/runtime/gc/accounting/card_table.h b/runtime/gc/accounting/card_table.h index 8d5dc07..17e62a6 100644 --- a/runtime/gc/accounting/card_table.h +++ b/runtime/gc/accounting/card_table.h @@ -20,7 +20,7 @@ #include "base/mutex.h" #include "globals.h" #include "mem_map.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc index 7cddaf4..ef5653a 100644 --- a/runtime/gc/accounting/mod_union_table.cc +++ b/runtime/gc/accounting/mod_union_table.cc @@ -30,7 +30,7 @@ #include "mirror/object_array-inl.h" #include "space_bitmap-inl.h" #include "thread.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" using ::art::mirror::Object; diff --git a/runtime/gc/accounting/remembered_set.cc b/runtime/gc/accounting/remembered_set.cc index bbbd1ed..1def334 100644 --- a/runtime/gc/accounting/remembered_set.cc +++ b/runtime/gc/accounting/remembered_set.cc @@ -30,7 +30,7 @@ #include "mirror/object_array-inl.h" #include "space_bitmap-inl.h" #include "thread.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { namespace gc { diff --git a/runtime/gc/accounting/space_bitmap-inl.h b/runtime/gc/accounting/space_bitmap-inl.h index 646fce6..a439462 100644 --- a/runtime/gc/accounting/space_bitmap-inl.h +++ b/runtime/gc/accounting/space_bitmap-inl.h @@ -28,7 +28,7 @@ #include "mirror/object_array-inl.h" #include "object_utils.h" #include "space_bitmap-inl.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "utils.h" namespace art { diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h index a805809..1ccebf5 100644 --- a/runtime/gc/accounting/space_bitmap.h +++ b/runtime/gc/accounting/space_bitmap.h @@ -22,7 +22,7 @@ #include "globals.h" #include "mem_map.h" #include "object_callbacks.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include <limits.h> #include <set> diff --git a/runtime/gc/accounting/space_bitmap_test.cc b/runtime/gc/accounting/space_bitmap_test.cc index 972f94d..71db44b 100644 --- a/runtime/gc/accounting/space_bitmap_test.cc +++ b/runtime/gc/accounting/space_bitmap_test.cc @@ -21,7 +21,7 @@ #include "common_runtime_test.h" #include "globals.h" #include "space_bitmap-inl.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { namespace gc { diff --git a/runtime/gc/allocator/rosalloc.h b/runtime/gc/allocator/rosalloc.h index 8557f1b..9ea4306 100644 --- a/runtime/gc/allocator/rosalloc.h +++ b/runtime/gc/allocator/rosalloc.h @@ -28,7 +28,7 @@ #include "base/logging.h" #include "globals.h" #include "mem_map.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "utils.h" // Ensure we have an unordered_set until we have worked out C++ library issues. diff --git a/runtime/gc/collector/mark_sweep.h b/runtime/gc/collector/mark_sweep.h index cfb0b5e..fd79bf6 100644 --- a/runtime/gc/collector/mark_sweep.h +++ b/runtime/gc/collector/mark_sweep.h @@ -26,7 +26,7 @@ #include "immune_region.h" #include "object_callbacks.h" #include "offsets.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/gc/collector/semi_space.h b/runtime/gc/collector/semi_space.h index 4b1ecc4..dacb5ae 100644 --- a/runtime/gc/collector/semi_space.h +++ b/runtime/gc/collector/semi_space.h @@ -25,7 +25,7 @@ #include "immune_region.h" #include "object_callbacks.h" #include "offsets.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 4642a98..b4c2d14 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -64,7 +64,7 @@ #include "scoped_thread_state_change.h" #include "handle_scope-inl.h" #include "thread_list.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "well_known_classes.h" namespace art { diff --git a/runtime/gc/space/large_object_space.cc b/runtime/gc/space/large_object_space.cc index 554fbbe..6c851af 100644 --- a/runtime/gc/space/large_object_space.cc +++ b/runtime/gc/space/large_object_space.cc @@ -20,7 +20,7 @@ #include "base/logging.h" #include "base/mutex-inl.h" #include "base/stl_util.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "image.h" #include "os.h" #include "space-inl.h" diff --git a/runtime/gc/space/space.h b/runtime/gc/space/space.h index dcf5357..343bc29 100644 --- a/runtime/gc/space/space.h +++ b/runtime/gc/space/space.h @@ -19,7 +19,7 @@ #include <string> -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "base/macros.h" #include "base/mutex.h" #include "gc/accounting/space_bitmap.h" diff --git a/runtime/gc/space/space_test.h b/runtime/gc/space/space_test.h index ce101e4..407d362 100644 --- a/runtime/gc/space/space_test.h +++ b/runtime/gc/space/space_test.h @@ -23,7 +23,7 @@ #include "common_runtime_test.h" #include "globals.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "mirror/array-inl.h" #include "mirror/object-inl.h" diff --git a/runtime/intern_table.cc b/runtime/intern_table.cc index dfc82dd..2a8cc63 100644 --- a/runtime/intern_table.cc +++ b/runtime/intern_table.cc @@ -22,7 +22,7 @@ #include "mirror/object-inl.h" #include "mirror/string.h" #include "thread.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "utf.h" namespace art { diff --git a/runtime/jdwp/jdwp_handler.cc b/runtime/jdwp/jdwp_handler.cc index 4843c2b..00be016 100644 --- a/runtime/jdwp/jdwp_handler.cc +++ b/runtime/jdwp/jdwp_handler.cc @@ -32,7 +32,7 @@ #include "jdwp/jdwp_priv.h" #include "runtime.h" #include "thread-inl.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc index 21dab8d..3afb149 100644 --- a/runtime/jni_internal.cc +++ b/runtime/jni_internal.cc @@ -49,7 +49,7 @@ #include "ScopedLocalRef.h" #include "thread.h" #include "utf.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "well_known_classes.h" namespace art { diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc index 98b0bbf..5225919 100644 --- a/runtime/mem_map.cc +++ b/runtime/mem_map.cc @@ -19,7 +19,7 @@ #include <inttypes.h> #include <backtrace/BacktraceMap.h> -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "base/stringprintf.h" #include "ScopedFd.h" #include "utils.h" diff --git a/runtime/mem_map_test.cc b/runtime/mem_map_test.cc index 2b59cd9..b26f563 100644 --- a/runtime/mem_map_test.cc +++ b/runtime/mem_map_test.cc @@ -16,7 +16,7 @@ #include "mem_map.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "gtest/gtest.h" namespace art { diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc index 537fe85..e0fd6a2 100644 --- a/runtime/mirror/object_test.cc +++ b/runtime/mirror/object_test.cc @@ -36,7 +36,7 @@ #include "object_array-inl.h" #include "handle_scope-inl.h" #include "string-inl.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { namespace mirror { diff --git a/runtime/os_linux.cc b/runtime/os_linux.cc index 7ce17e0..d9a5813 100644 --- a/runtime/os_linux.cc +++ b/runtime/os_linux.cc @@ -23,7 +23,7 @@ #include "base/logging.h" #include "base/unix_file/fd_file.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/parsed_options_test.cc b/runtime/parsed_options_test.cc index 7f293cd..39f7638 100644 --- a/runtime/parsed_options_test.cc +++ b/runtime/parsed_options_test.cc @@ -16,7 +16,7 @@ #include "parsed_options.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "common_runtime_test.h" namespace art { diff --git a/runtime/profiler.h b/runtime/profiler.h index 31fdc79..bcd7c29 100644 --- a/runtime/profiler.h +++ b/runtime/profiler.h @@ -29,7 +29,7 @@ #include "instrumentation.h" #include "os.h" #include "safe_map.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 78a93fd..d183cba 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -72,7 +72,7 @@ #include "trace.h" #include "transaction.h" #include "profiler.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "verifier/method_verifier.h" #include "well_known_classes.h" diff --git a/runtime/thread.h b/runtime/thread.h index 83f7b8e..be7634f 100644 --- a/runtime/thread.h +++ b/runtime/thread.h @@ -39,7 +39,7 @@ #include "stack.h" #include "thread_state.h" #include "throw_location.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/trace.h b/runtime/trace.h index bf4995a..ef6c642 100644 --- a/runtime/trace.h +++ b/runtime/trace.h @@ -27,7 +27,7 @@ #include "instrumentation.h" #include "os.h" #include "safe_map.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/utils.cc b/runtime/utils.cc index c332bdf..f26b598 100644 --- a/runtime/utils.cc +++ b/runtime/utils.cc @@ -25,7 +25,7 @@ #include <unistd.h> -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "base/stl_util.h" #include "base/unix_file/fd_file.h" #include "dex_file-inl.h" diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index cea2403..14200f7 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -33,7 +33,7 @@ #include "reg_type_cache-inl.h" #include "register_line.h" #include "safe_map.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/verifier/method_verifier_test.cc b/runtime/verifier/method_verifier_test.cc index 9dca7f5..2bcf3e0 100644 --- a/runtime/verifier/method_verifier_test.cc +++ b/runtime/verifier/method_verifier_test.cc @@ -18,7 +18,7 @@ #include <stdio.h> -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "class_linker.h" #include "common_runtime_test.h" #include "dex_file.h" diff --git a/runtime/verifier/register_line.h b/runtime/verifier/register_line.h index 8b2dadb..f9f3e31 100644 --- a/runtime/verifier/register_line.h +++ b/runtime/verifier/register_line.h @@ -22,7 +22,7 @@ #include "dex_instruction.h" #include "reg_type.h" #include "safe_map.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { namespace verifier { diff --git a/runtime/zip_archive.cc b/runtime/zip_archive.cc index ddac7d4..13b4219 100644 --- a/runtime/zip_archive.cc +++ b/runtime/zip_archive.cc @@ -26,7 +26,7 @@ #include "base/stringprintf.h" #include "base/unix_file/fd_file.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/zip_archive.h b/runtime/zip_archive.h index 3ef0e6b..edaa88b 100644 --- a/runtime/zip_archive.h +++ b/runtime/zip_archive.h @@ -27,7 +27,7 @@ #include "mem_map.h" #include "os.h" #include "safe_map.h" -#include "UniquePtr.h" +#include "UniquePtrCompat.h" namespace art { diff --git a/runtime/zip_archive_test.cc b/runtime/zip_archive_test.cc index c43fee5..d0624cf 100644 --- a/runtime/zip_archive_test.cc +++ b/runtime/zip_archive_test.cc @@ -21,7 +21,7 @@ #include <sys/types.h> #include <zlib.h> -#include "UniquePtr.h" +#include "UniquePtrCompat.h" #include "common_runtime_test.h" #include "os.h" |