0

Add RAW_PTR_EXCLUSION to files in mojo/ etc.

Add RAW_PTR_EXCLUSION to files in mojo/ etc. where the rewriter could not automatically rewrite.

Change was generated by processing the output of the rewriter.

Bug: 1273182
Change-Id: I9490baa7ecdd17dbacb3180324da0f0e5e7e2401
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4173490
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Owners-Override: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1094321}
This commit is contained in:
Keishi Hattori
2023-01-19 07:18:47 +00:00
committed by Chromium LUCI CQ
parent 2ab70931a4
commit ae11765762
12 changed files with 60 additions and 15 deletions
mojo
core
public
printing/backend
remoting
sandbox/linux/integration_tests
tools/clang/rewrite_raw_ptr_fields

@ -11,6 +11,7 @@
#include "base/check.h" #include "base/check.h"
#include "base/containers/span.h" #include "base/containers/span.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "mojo/core/ipcz_driver/shared_buffer.h" #include "mojo/core/ipcz_driver/shared_buffer.h"
#include "mojo/core/ipcz_driver/shared_buffer_mapping.h" #include "mojo/core/ipcz_driver/shared_buffer_mapping.h"
@ -50,7 +51,9 @@ class MOJO_SYSTEM_IMPL_EXPORT RingBuffer {
} }
private: private:
RingBuffer* buffer_; // This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #union
RAW_PTR_EXCLUSION RingBuffer* buffer_;
const Bytes bytes_; const Bytes bytes_;
}; };
@ -80,7 +83,9 @@ class MOJO_SYSTEM_IMPL_EXPORT RingBuffer {
} }
private: private:
RingBuffer* buffer_; // This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #union
RAW_PTR_EXCLUSION RingBuffer* buffer_;
const Bytes bytes_; const Bytes bytes_;
}; };

@ -82,7 +82,9 @@ class COMPONENT_EXPORT(MOJO_CORE_PORTS) SinglePortLocker {
Port* port() const { return locker_.GetPort(*port_ref_); } Port* port() const { return locker_.GetPort(*port_ref_); }
private: private:
const PortRef* port_ref_; // This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #addr-of
RAW_PTR_EXCLUSION const PortRef* port_ref_;
PortLocker locker_; PortLocker locker_;
}; };

@ -11,6 +11,7 @@
#include <vector> #include <vector>
#include "base/component_export.h" #include "base/component_export.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "mojo/public/cpp/system/handle.h" #include "mojo/public/cpp/system/handle.h"
#include "mojo/public/cpp/system/message.h" #include "mojo/public/cpp/system/message.h"
@ -118,7 +119,9 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS_BASE) Buffer {
// The storage location and capacity currently backing |message_|. Owned by // The storage location and capacity currently backing |message_|. Owned by
// the message object internally, not by this Buffer. // the message object internally, not by this Buffer.
void* data_ = nullptr; // This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #union, #addr-of
RAW_PTR_EXCLUSION void* data_ = nullptr;
size_t size_ = 0; size_t size_ = 0;
// The current write offset into |data_| if this Buffer is being used for // The current write offset into |data_| if this Buffer is being used for

@ -14,6 +14,7 @@
#include "base/location.h" #include "base/location.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/rand_util.h" #include "base/rand_util.h"
@ -78,9 +79,15 @@ class Connector::ActiveDispatchTracker {
private: private:
const base::WeakPtr<Connector> connector_; const base::WeakPtr<Connector> connector_;
RunLoopNestingObserver* const nesting_observer_; // This field is not a raw_ptr<> because it was filtered by the rewriter for:
ActiveDispatchTracker* outer_tracker_ = nullptr; // #union
ActiveDispatchTracker* inner_tracker_ = nullptr; RAW_PTR_EXCLUSION RunLoopNestingObserver* const nesting_observer_;
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #union
RAW_PTR_EXCLUSION ActiveDispatchTracker* outer_tracker_ = nullptr;
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #union
RAW_PTR_EXCLUSION ActiveDispatchTracker* inner_tracker_ = nullptr;
}; };
// Watches the MessageLoop on the current thread. Notifies the current chain of // Watches the MessageLoop on the current thread. Notifies the current chain of

@ -142,7 +142,9 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) ReceiverSetState {
RepeatingConnectionErrorWithReasonCallback disconnect_with_reason_handler_; RepeatingConnectionErrorWithReasonCallback disconnect_with_reason_handler_;
ReceiverId next_receiver_id_ = 0; ReceiverId next_receiver_id_ = 0;
EntryMap entries_; EntryMap entries_;
void* current_context_ = nullptr; // This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #union
RAW_PTR_EXCLUSION void* current_context_ = nullptr;
ReceiverId current_receiver_; ReceiverId current_receiver_;
base::WeakPtrFactory<ReceiverSetState> weak_ptr_factory_{this}; base::WeakPtrFactory<ReceiverSetState> weak_ptr_factory_{this};
}; };

@ -14,6 +14,7 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
@ -40,7 +41,9 @@ namespace {
struct CupsDestsData { struct CupsDestsData {
int num_dests; int num_dests;
cups_dest_t* dests; // This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #reinterpret-cast-trivial-type, #addr-of
RAW_PTR_EXCLUSION cups_dest_t* dests;
}; };
int CaptureCupsDestCallback(void* data, unsigned flags, cups_dest_t* dest) { int CaptureCupsDestCallback(void* data, unsigned flags, cups_dest_t* dest) {

@ -5,6 +5,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "base/memory/raw_ptr_exclusion.h"
#include "remoting/base/result.h" #include "remoting/base/result.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
@ -158,7 +159,9 @@ TEST(Result, Destruction) {
~DestructIncrement() { ++(*variable_); } ~DestructIncrement() { ++(*variable_); }
private: private:
int* variable_; // This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #union
RAW_PTR_EXCLUSION int* variable_;
}; };
int success_count = 0; int success_count = 0;

@ -11,6 +11,7 @@
#include "base/functional/callback_helpers.h" #include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h" #include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h" #include "base/test/bind.h"
@ -285,8 +286,14 @@ class ChromotingHostTest : public testing::Test {
std::string session_unowned_jid1_; std::string session_unowned_jid1_;
std::unique_ptr<MockSession> session_unowned2_; // Not owned by a connection. std::unique_ptr<MockSession> session_unowned2_; // Not owned by a connection.
std::string session_unowned_jid2_; std::string session_unowned_jid2_;
protocol::Session::EventHandler* session_unowned1_event_handler_; // This field is not a raw_ptr<> because it was filtered by the rewriter for:
protocol::Session::EventHandler* session_unowned2_event_handler_; // #addr-of
RAW_PTR_EXCLUSION protocol::Session::EventHandler*
session_unowned1_event_handler_;
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #addr-of
RAW_PTR_EXCLUSION protocol::Session::EventHandler*
session_unowned2_event_handler_;
named_mojo_ipc_server::FakeIpcServer::TestState ipc_server_test_state_; named_mojo_ipc_server::FakeIpcServer::TestState ipc_server_test_state_;
// Returns the cached client pointers client1_ or client2_. // Returns the cached client pointers client1_ or client2_.

@ -41,6 +41,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/process/launch.h" #include "base/process/launch.h"
#include "base/strings/strcat.h" #include "base/strings/strcat.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
@ -282,7 +283,9 @@ class PamHandle {
} }
private: private:
pam_handle_t* pam_handle_ = nullptr; // This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #addr-of
RAW_PTR_EXCLUSION pam_handle_t* pam_handle_ = nullptr;
int last_return_code_ = PAM_SUCCESS; int last_return_code_ = PAM_SUCCESS;
}; };

@ -8,6 +8,7 @@
#include "base/functional/bind.h" #include "base/functional/bind.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/numerics/math_constants.h" #include "base/numerics/math_constants.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
@ -109,7 +110,9 @@ class TestScreenCapturer : public DesktopCapturer {
void FailNthFrame(int n) { capture_request_index_to_fail_ = n; } void FailNthFrame(int n) { capture_request_index_to_fail_ = n; }
private: private:
Callback* callback_ = nullptr; // This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #constexpr-ctor-field-initializer
RAW_PTR_EXCLUSION Callback* callback_ = nullptr;
int frame_index_ = 0; int frame_index_ = 0;
int capture_request_index_to_fail_ = -1; int capture_request_index_to_fail_ = -1;

@ -18,6 +18,8 @@
#include <sys/utsname.h> #include <sys/utsname.h>
#include <unistd.h> #include <unistd.h>
#include "base/memory/raw_ptr_exclusion.h"
#if defined(ANDROID) #if defined(ANDROID)
// Work-around for buggy headers in Android's NDK // Work-around for buggy headers in Android's NDK
#define __user #define __user
@ -921,7 +923,9 @@ class EqualityStressTest {
struct ArgValue { struct ArgValue {
int argno; // Argument number to inspect. int argno; // Argument number to inspect.
int size; // Number of test cases (must be > 0). int size; // Number of test cases (must be > 0).
struct Tests { // This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #overlapping
RAW_PTR_EXCLUSION struct Tests {
uint32_t k_value; // Value to compare syscall arg against. uint32_t k_value; // Value to compare syscall arg against.
int err; // If non-zero, errno value to return. int err; // If non-zero, errno value to return.
raw_ptr<struct ArgValue> raw_ptr<struct ArgValue>

@ -53,6 +53,9 @@ ui/qt/
# provide a stable C ABI. Can't depend on //base. # provide a stable C ABI. Can't depend on //base.
android_webview/public/ android_webview/public/
# Exclude dir that should hold C headers.
mojo/public/c/
# Exclude code that only runs inside a renderer process - renderer # Exclude code that only runs inside a renderer process - renderer
# processes are excluded for now from the MiraclePtr project scope, # processes are excluded for now from the MiraclePtr project scope,
# because they are sensitive to performance regressions (to a much higher # because they are sensitive to performance regressions (to a much higher