[go: nahoru, domu]

Rewrite most `Foo* field_` pointer fields to `raw_ptr<Foo> field_`.

DO NOT REVERT (unless absolutely necessary)! Report build breaks to keishi@(APAC)/glazunov@(EMEA)/sebmarchand@(NA) as soon as you see them. Fixes are expected to be trivial.

This commit was generated automatically, by running the following script: tools/clang/rewrite_raw_ptr_fields/rewrite-multiple-platforms.sh on commit fe74bc434e5b7e92d13a328362fcb6df15d8847e

For more information, see MiraclePtr One Pager [1], the PSA at chromium-dev@ [2], and the raw_ptr documentation in //base/memory/raw_ptr.md.

FYI This CL does not enable MiraclePtr protection and we expect no behavior change from this.

[1] https://docs.google.com/document/d/1pnnOAIz_DMWDI4oIOFoMAqLnf_MZ2GsrJNb_dbQ3ZBg/edit?usp=sharing
[2] https://groups.google.com/a/chromium.org/g/chromium-dev/c/vAEeVifyf78/m/SkBUc6PhBAAJ

Binary-Size: Increase of around 500kb was approved for MiraclePtr
Include-Ci-Only-Tests: true
No-Tree-Checks: true
No-Presubmit: true
Bug: 1272324, 1073933
Change-Id: I05c86a83bbb4b3f4b017f361dd7f4e7437697f69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3305132
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Owners-Override: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/main@{#945735}
diff --git a/courgette/adjustment_method_2.cc b/courgette/adjustment_method_2.cc
index 6caca46..0f693fa 100644
--- a/courgette/adjustment_method_2.cc
+++ b/courgette/adjustment_method_2.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "base/memory/raw_ptr.h"
 #include "courgette/adjustment_method.h"
 
 #include <stddef.h>
@@ -179,7 +180,7 @@
 
   AssignmentCandidates* candidates();
 
-  Label* label_;             // The label that this info a surrogate for.
+  raw_ptr<Label> label_;  // The label that this info a surrogate for.
 
   uint32_t is_model_ : 1;      // Is the label in the model?
   uint32_t debug_index_ : 31;  // A small number for naming the label in debug
@@ -188,12 +189,13 @@
 
   int refs_;                 // Number of times this Label is referenced.
 
-  LabelInfo* assignment_;    // Label from other program corresponding to this.
+  raw_ptr<LabelInfo>
+      assignment_;  // Label from other program corresponding to this.
 
   std::vector<uint32_t> positions_;  // Offsets into the trace of references.
 
  private:
-  AssignmentCandidates* candidates_;
+  raw_ptr<AssignmentCandidates> candidates_;
 
   void operator=(const LabelInfo*);  // Disallow assignment only.
   // Public compiler generated copy constructor is needed to constuct
@@ -349,7 +351,7 @@
   };
   typedef std::set<ScoreAndLabel, OrderScoreAndLabelByScoreDecreasing> Queue;
 
-  LabelInfo* program_info_;
+  raw_ptr<LabelInfo> program_info_;
   LabelToScore label_to_score_;
   LabelToScore pending_updates_;
   Queue queue_;
@@ -427,7 +429,8 @@
   size_t exemplar_position_;       // At this position (and other positions).
   std::vector<uint32_t> positions_;  // Includes exemplar_position_.
 
-  ShinglePattern* pattern_;       // Pattern changes as LabelInfos are assigned.
+  raw_ptr<ShinglePattern>
+      pattern_;  // Pattern changes as LabelInfos are assigned.
 
   friend std::string ToString(const Shingle* instance);
 };
@@ -518,7 +521,8 @@
   ShinglePattern()
       : index_(nullptr), model_coverage_(0), program_coverage_(0) {}
 
-  const Index* index_;  // Points to the key in the owning map value_type.
+  raw_ptr<const Index>
+      index_;  // Points to the key in the owning map value_type.
   Histogram model_histogram_;
   Histogram program_histogram_;
   int model_coverage_;
@@ -1287,8 +1291,9 @@
         label, is_model, static_cast<uint32_t>(trace->size())));
   }
 
-  AssemblyProgram* prog_;         // Program to be adjusted, owned by caller.
-  const AssemblyProgram* model_;  // Program to be mimicked, owned by caller.
+  raw_ptr<AssemblyProgram> prog_;  // Program to be adjusted, owned by caller.
+  raw_ptr<const AssemblyProgram>
+      model_;  // Program to be mimicked, owned by caller.
 
   LabelInfoMaker label_info_maker_;
 };