]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
constify inchash
authorRichard Biener <rguenther@suse.de>
Mon, 22 Jul 2024 09:09:03 +0000 (11:09 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 22 Jul 2024 11:00:30 +0000 (13:00 +0200)
The following constifies parts of inchash.

* inchash.h (inchash::end): Make const.
(inchash::merge): Take const reference hash argument.
(inchash::add_commutative): Likewise.

gcc/inchash.h

index e88f9b5eac189526c103573b7119ac4aedcd045b..82f50eb0f258e0e5269d802dec060fb9659669b9 100644 (file)
@@ -46,7 +46,7 @@ class hash
   }
 
   /* End incremential hashing and provide the final value.  */
-  hashval_t end ()
+  hashval_t end () const
   {
     return val;
   }
@@ -109,7 +109,7 @@ class hash
   }
 
   /* Hash in state from other inchash OTHER.  */
-  void merge (hash &other)
+  void merge (const hash &other)
   {
     merge_hash (other.val);
   }
@@ -136,7 +136,7 @@ class hash
      based on their value. This is useful for hashing commutative
      expressions, so that A+B and B+A get the same hash.  */
 
-  void add_commutative (hash &a, hash &b)
+  void add_commutative (const hash &a, const hash &b)
   {
     if (a.end() > b.end())
       {