Add visibility attributes in runtime/c*
Bug: 260881207
Test: presubmit
Test: abtd app_compat_drm
Test: abtd app_compat_top_100
Test: abtd app_compat_banking
Change-Id: Id729aca1d8b6d003ff3e9755112f3283e9f2b507
diff --git a/runtime/cha.cc b/runtime/cha.cc
index 0c548d3..da355b7 100644
--- a/runtime/cha.cc
+++ b/runtime/cha.cc
@@ -30,7 +30,7 @@
#include "thread_list.h"
#include "thread_pool.h"
-namespace art {
+namespace art HIDDEN {
void ClassHierarchyAnalysis::AddDependency(ArtMethod* method,
ArtMethod* dependent_method,
diff --git a/runtime/cha.h b/runtime/cha.h
index 8d4c3c5..ffdf00a 100644
--- a/runtime/cha.h
+++ b/runtime/cha.h
@@ -22,11 +22,12 @@
#include "base/enums.h"
#include "base/locks.h"
+#include "base/macros.h"
#include "handle.h"
#include "mirror/class.h"
#include "oat/oat_quick_method_header.h"
-namespace art {
+namespace art HIDDEN {
class ArtMethod;
class LinearAlloc;
diff --git a/runtime/cha_test.cc b/runtime/cha_test.cc
index 48fd06d..47633a3 100644
--- a/runtime/cha_test.cc
+++ b/runtime/cha_test.cc
@@ -19,7 +19,7 @@
#include "base/common_art_test.h"
#include "thread-current-inl.h"
-namespace art {
+namespace art HIDDEN {
class CHATest : public CommonArtTest {};
diff --git a/runtime/check_reference_map_visitor.h b/runtime/check_reference_map_visitor.h
index de4986c..a4196e6 100644
--- a/runtime/check_reference_map_visitor.h
+++ b/runtime/check_reference_map_visitor.h
@@ -18,6 +18,7 @@
#define ART_RUNTIME_CHECK_REFERENCE_MAP_VISITOR_H_
#include "art_method-inl.h"
+#include "base/macros.h"
#include "dex/code_item_accessors-inl.h"
#include "dex/dex_file_types.h"
#include "oat/oat_quick_method_header.h"
@@ -25,7 +26,7 @@
#include "scoped_thread_state_change-inl.h"
#include "stack.h"
-namespace art {
+namespace art HIDDEN {
// Helper class for tests checking that the compiler keeps track of dex registers
// holding references.
diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h
index e22387f..e771341 100644
--- a/runtime/class_linker-inl.h
+++ b/runtime/class_linker-inl.h
@@ -37,7 +37,7 @@
#include "obj_ptr-inl.h"
#include "scoped_thread_state_change-inl.h"
-namespace art {
+namespace art HIDDEN {
inline ObjPtr<mirror::Class> ClassLinker::FindArrayClass(Thread* self,
ObjPtr<mirror::Class> element_class) {
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 0e8bfb0..57dbd6d 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -158,7 +158,7 @@
#include "verifier/verifier_deps.h"
#include "well_known_classes.h"
-namespace art {
+namespace art HIDDEN {
using android::base::StringPrintf;
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 9fc937f..5597149 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -44,7 +44,7 @@
#include "oat/oat_file.h"
#include "verifier/verifier_enums.h"
-namespace art {
+namespace art HIDDEN {
class ArtField;
class ArtMethod;
@@ -158,7 +158,7 @@
REQUIRES_SHARED(Locks::classlinker_classes_lock_, Locks::mutator_lock_) = 0;
};
-class ClassLinker {
+class EXPORT ClassLinker {
public:
static constexpr bool kAppImageMayContainStrings = true;
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 605b1c4..97f79b7 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -59,7 +59,7 @@
#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
-namespace art {
+namespace art HIDDEN {
class ClassLinkerTest : public CommonRuntimeTest {
protected:
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index 81eb11c..988955c 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -47,7 +47,7 @@
#include "thread.h"
#include "well_known_classes-inl.h"
-namespace art {
+namespace art HIDDEN {
static constexpr char kPathClassLoaderString[] = "PCL";
static constexpr char kDelegateLastClassLoaderString[] = "DLC";
diff --git a/runtime/class_loader_context.h b/runtime/class_loader_context.h
index cfb0457..6b819f4 100644
--- a/runtime/class_loader_context.h
+++ b/runtime/class_loader_context.h
@@ -23,19 +23,20 @@
#include "arch/instruction_set.h"
#include "base/dchecked_vector.h"
+#include "base/macros.h"
#include "dex/dex_file.h"
#include "handle_scope.h"
#include "mirror/class_loader.h"
#include "oat/oat_file.h"
#include "scoped_thread_state_change.h"
-namespace art {
+namespace art HIDDEN {
class DexFile;
class OatFile;
// Utility class which holds the class loader context used during compilation/verification.
-class ClassLoaderContext {
+class EXPORT ClassLoaderContext {
public:
enum class VerificationResult {
kVerifies,
diff --git a/runtime/class_loader_context_test.cc b/runtime/class_loader_context_test.cc
index 1744e4e..ec7abb7 100644
--- a/runtime/class_loader_context_test.cc
+++ b/runtime/class_loader_context_test.cc
@@ -46,7 +46,7 @@
#include "thread.h"
#include "well_known_classes-inl.h"
-namespace art {
+namespace art HIDDEN {
class ClassLoaderContextTest : public CommonRuntimeTest {
public:
diff --git a/runtime/class_loader_utils.h b/runtime/class_loader_utils.h
index 6868b3f..54662bf 100644
--- a/runtime/class_loader_utils.h
+++ b/runtime/class_loader_utils.h
@@ -19,6 +19,7 @@
#include "art_field-inl.h"
#include "base/locks.h"
+#include "base/macros.h"
#include "handle_scope.h"
#include "jni/jni_internal.h"
#include "mirror/class_loader.h"
@@ -28,7 +29,7 @@
#include "scoped_thread_state_change-inl.h"
#include "well_known_classes-inl.h"
-namespace art {
+namespace art HIDDEN {
// Returns true if the given class loader derives from BaseDexClassLoader.
inline bool IsInstanceOfBaseDexClassLoader(Handle<mirror::ClassLoader> class_loader)
diff --git a/runtime/class_root-inl.h b/runtime/class_root-inl.h
index d88b8e1..871f5f3 100644
--- a/runtime/class_root-inl.h
+++ b/runtime/class_root-inl.h
@@ -25,7 +25,7 @@
#include "obj_ptr-inl.h"
#include "runtime.h"
-namespace art {
+namespace art HIDDEN {
template <ReadBarrierOption kReadBarrierOption>
inline ObjPtr<mirror::Class> GetClassRoot(ClassRoot class_root,
diff --git a/runtime/class_root.cc b/runtime/class_root.cc
index 6a6fd26..f0eb761 100644
--- a/runtime/class_root.cc
+++ b/runtime/class_root.cc
@@ -18,7 +18,7 @@
#include "base/logging.h"
-namespace art {
+namespace art HIDDEN {
const char* GetClassRootDescriptor(ClassRoot class_root) {
static const char* const class_roots_descriptors[] = {
diff --git a/runtime/class_root.h b/runtime/class_root.h
index baa2128..67e369f 100644
--- a/runtime/class_root.h
+++ b/runtime/class_root.h
@@ -20,9 +20,10 @@
#include <stdint.h>
#include "base/locks.h"
+#include "base/macros.h"
#include "read_barrier_option.h"
-namespace art {
+namespace art HIDDEN {
class ClassLinker;
template<class MirrorType> class ObjPtr;
diff --git a/runtime/class_status.h b/runtime/class_status.h
index 6c686a4..fc41b1c 100644
--- a/runtime/class_status.h
+++ b/runtime/class_status.h
@@ -20,7 +20,9 @@
#include <iosfwd>
#include <stdint.h>
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
// Class Status
//
@@ -99,7 +101,7 @@
kLast = kVisiblyInitialized
};
-std::ostream& operator<<(std::ostream& os, ClassStatus rhs);
+EXPORT std::ostream& operator<<(std::ostream& os, ClassStatus rhs);
} // namespace art
diff --git a/runtime/class_table-inl.h b/runtime/class_table-inl.h
index 55ecb78..8a8487c 100644
--- a/runtime/class_table-inl.h
+++ b/runtime/class_table-inl.h
@@ -26,7 +26,7 @@
#include "oat/oat_file.h"
#include "obj_ptr-inl.h"
-namespace art {
+namespace art HIDDEN {
inline ClassTable::TableSlot::TableSlot(ObjPtr<mirror::Class> klass)
: TableSlot(klass, klass->DescriptorHash()) {}
diff --git a/runtime/class_table.cc b/runtime/class_table.cc
index 12d0697..f66bd1e 100644
--- a/runtime/class_table.cc
+++ b/runtime/class_table.cc
@@ -21,7 +21,7 @@
#include "mirror/string-inl.h"
#include "oat/oat_file.h"
-namespace art {
+namespace art HIDDEN {
ClassTable::ClassTable() : lock_("Class loader classes", kClassLoaderClassesLock) {
Runtime* const runtime = Runtime::Current();
diff --git a/runtime/class_table.h b/runtime/class_table.h
index 54e066a..1c9b0ce 100644
--- a/runtime/class_table.h
+++ b/runtime/class_table.h
@@ -28,7 +28,7 @@
#include "gc_root.h"
#include "obj_ptr.h"
-namespace art {
+namespace art HIDDEN {
class OatFile;
@@ -153,7 +153,7 @@
ClassDescriptorEquals,
GcRootArenaAllocator<TableSlot, kAllocatorTagClassTable>>;
- ClassTable();
+ EXPORT ClassTable();
// Freeze the current class tables by allocating a new table and never updating or modifying the
// existing table. This helps prevents dirty pages after caused by inserting after zygote fork.
@@ -172,7 +172,7 @@
REQUIRES_SHARED(Locks::mutator_lock_);
// Returns the number of classes in previous snapshots no matter the defining loader.
- size_t NumReferencedZygoteClasses() const
+ EXPORT size_t NumReferencedZygoteClasses() const
REQUIRES(!lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
@@ -252,7 +252,7 @@
REQUIRES_SHARED(Locks::mutator_lock_);
// Read a table from ptr and put it at the front of the class set.
- size_t ReadFromMemory(uint8_t* ptr)
+ EXPORT size_t ReadFromMemory(uint8_t* ptr)
REQUIRES(!lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
diff --git a/runtime/class_table_test.cc b/runtime/class_table_test.cc
index 14c5d70..15cca6d 100644
--- a/runtime/class_table_test.cc
+++ b/runtime/class_table_test.cc
@@ -28,7 +28,7 @@
#include "obj_ptr.h"
#include "scoped_thread_state_change-inl.h"
-namespace art {
+namespace art HIDDEN {
namespace mirror {
class CollectRootVisitor {
diff --git a/runtime/common_dex_operations.h b/runtime/common_dex_operations.h
index ce2090c..58b54af 100644
--- a/runtime/common_dex_operations.h
+++ b/runtime/common_dex_operations.h
@@ -42,7 +42,7 @@
#include "stack.h"
#include "thread.h"
-namespace art {
+namespace art HIDDEN {
namespace interpreter {
void ArtInterpreterToInterpreterBridge(Thread* self,
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index ee574bc..922d678 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -65,7 +65,7 @@
#include "thread.h"
#include "well_known_classes-inl.h"
-namespace art {
+namespace art HIDDEN {
using android::base::StringPrintf;
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index e82db84..0f164a7 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -28,6 +28,7 @@
#include "arch/instruction_set.h"
#include "base/common_art_test.h"
#include "base/locks.h"
+#include "base/macros.h"
#include "base/os.h"
#include "base/unix_file/fd_file.h"
#include "dex/art_dex_file_loader.h"
@@ -37,7 +38,7 @@
#include "runtime_globals.h"
#include "scoped_thread_state_change-inl.h"
-namespace art {
+namespace art HIDDEN {
class MethodReference;
class TypeReference;
diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc
index 5182689..3724866 100644
--- a/runtime/common_throws.cc
+++ b/runtime/common_throws.cc
@@ -38,7 +38,7 @@
#include "thread.h"
#include "well_known_classes-inl.h"
-namespace art {
+namespace art HIDDEN {
using android::base::StringAppendV;
using android::base::StringPrintf;
diff --git a/runtime/common_throws.h b/runtime/common_throws.h
index d9620df..aeba3bb 100644
--- a/runtime/common_throws.h
+++ b/runtime/common_throws.h
@@ -20,9 +20,10 @@
#include <string_view>
#include "base/locks.h"
+#include "base/macros.h"
#include "obj_ptr.h"
-namespace art {
+namespace art HIDDEN {
namespace mirror {
class Class;
class Object;
@@ -83,13 +84,13 @@
// ClassFormatError
-void ThrowClassFormatError(ObjPtr<mirror::Class> referrer, const char* fmt, ...)
- __attribute__((__format__(__printf__, 2, 3)))
- REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
+EXPORT void ThrowClassFormatError(ObjPtr<mirror::Class> referrer, const char* fmt, ...)
+ __attribute__((__format__(__printf__, 2, 3))) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
// IllegalAccessError
-void ThrowIllegalAccessErrorClass(ObjPtr<mirror::Class> referrer, ObjPtr<mirror::Class> accessed)
+EXPORT void ThrowIllegalAccessErrorClass(ObjPtr<mirror::Class> referrer,
+ ObjPtr<mirror::Class> accessed)
REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
void ThrowIllegalAccessErrorClassForMethodDispatch(ObjPtr<mirror::Class> referrer,
@@ -101,10 +102,10 @@
void ThrowIllegalAccessErrorMethod(ObjPtr<mirror::Class> referrer, ArtMethod* accessed)
REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
-void ThrowIllegalAccessErrorField(ObjPtr<mirror::Class> referrer, ArtField* accessed)
+EXPORT void ThrowIllegalAccessErrorField(ObjPtr<mirror::Class> referrer, ArtField* accessed)
REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
-void ThrowIllegalAccessErrorFinalField(ArtMethod* referrer, ArtField* accessed)
+EXPORT void ThrowIllegalAccessErrorFinalField(ArtMethod* referrer, ArtField* accessed)
REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
void ThrowIllegalAccessError(ObjPtr<mirror::Class> referrer, const char* fmt, ...)
@@ -128,7 +129,7 @@
// IllegalAccessException
-void ThrowIllegalStateException(const char* msg)
+EXPORT void ThrowIllegalStateException(const char* msg)
REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
// IncompatibleClassChangeError
@@ -144,9 +145,9 @@
ArtMethod* referrer)
REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
-void ThrowIncompatibleClassChangeErrorField(ArtField* resolved_field,
- bool is_static,
- ArtMethod* referrer)
+EXPORT void ThrowIncompatibleClassChangeErrorField(ArtField* resolved_field,
+ bool is_static,
+ ArtMethod* referrer)
REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
void ThrowIncompatibleClassChangeError(ObjPtr<mirror::Class> referrer, const char* fmt, ...)
@@ -196,10 +197,10 @@
// NoSuchFieldError
-void ThrowNoSuchFieldError(std::string_view scope,
- ObjPtr<mirror::Class> c,
- std::string_view type,
- std::string_view name)
+EXPORT void ThrowNoSuchFieldError(std::string_view scope,
+ ObjPtr<mirror::Class> c,
+ std::string_view type,
+ std::string_view name)
REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
void ThrowNoSuchFieldException(ObjPtr<mirror::Class> c, std::string_view name)
@@ -229,7 +230,7 @@
void ThrowNullPointerExceptionFromDexPC(bool check_address = false, uintptr_t addr = 0)
REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
-void ThrowNullPointerException(const char* msg)
+EXPORT void ThrowNullPointerException(const char* msg)
REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR;
void ThrowNullPointerException()
diff --git a/runtime/compat_framework.cc b/runtime/compat_framework.cc
index 17d423b..e693508 100644
--- a/runtime/compat_framework.cc
+++ b/runtime/compat_framework.cc
@@ -22,7 +22,7 @@
#include "android-base/logging.h"
#include "thread-current-inl.h"
-namespace art {
+namespace art HIDDEN {
// Compat change states as strings.
static constexpr char kUnknownChangeState[] = "UNKNOWN";
diff --git a/runtime/compat_framework.h b/runtime/compat_framework.h
index 99a9215..1e71362 100644
--- a/runtime/compat_framework.h
+++ b/runtime/compat_framework.h
@@ -23,7 +23,7 @@
#include "base/mutex.h"
#include "base/string_view_cpp20.h"
-namespace art {
+namespace art HIDDEN {
// ART counterpart of the compat framework (go/compat-framework).
// Created in order to avoid repeated up-calls to Java.
diff --git a/runtime/compilation_kind.h b/runtime/compilation_kind.h
index c289e98..08c5025 100644
--- a/runtime/compilation_kind.h
+++ b/runtime/compilation_kind.h
@@ -20,7 +20,9 @@
#include <iosfwd>
#include <stdint.h>
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
enum class CompilationKind {
kOsr,
diff --git a/runtime/compiler_callbacks.h b/runtime/compiler_callbacks.h
index 3fa2fa3..cd6f6b8 100644
--- a/runtime/compiler_callbacks.h
+++ b/runtime/compiler_callbacks.h
@@ -18,11 +18,12 @@
#define ART_RUNTIME_COMPILER_CALLBACKS_H_
#include "base/locks.h"
+#include "base/macros.h"
#include "class_status.h"
#include "dex/class_reference.h"
#include "dex/method_reference.h"
-namespace art {
+namespace art HIDDEN {
class CompilerDriver;