[llvm] 8f69da9 - [ElementCount] NFC: Set 'const' qualifier for getWithIncrement/Decrement.

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 03:28:18 PST 2021


Author: Sander de Smalen
Date: 2021-02-04T11:27:45Z
New Revision: 8f69da9f9759c0479c365d3e316d474b9b3fe7c9

URL: https://github.com/llvm/llvm-project/commit/8f69da9f9759c0479c365d3e316d474b9b3fe7c9
DIFF: https://github.com/llvm/llvm-project/commit/8f69da9f9759c0479c365d3e316d474b9b3fe7c9.diff

LOG: [ElementCount] NFC: Set 'const' qualifier for getWithIncrement/Decrement.

These class methods simply return a new UnivariateLinearPolyBase
(e.g. ElementCount), and do not modify the object in any way or form,
so qualify for being 'const'.

Added: 
    

Modified: 
    llvm/include/llvm/Support/TypeSize.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h
index d277affdbb23..4085e06d2584 100644
--- a/llvm/include/llvm/Support/TypeSize.h
+++ b/llvm/include/llvm/Support/TypeSize.h
@@ -231,13 +231,13 @@ class UnivariateLinearPolyBase {
   }
 
   /// Add \p RHS to the value at the univariate dimension.
-  LeafTy getWithIncrement(ScalarTy RHS) {
+  LeafTy getWithIncrement(ScalarTy RHS) const {
     return static_cast<LeafTy>(
         UnivariateLinearPolyBase(Value + RHS, UnivariateDim));
   }
 
   /// Subtract \p RHS from the value at the univariate dimension.
-  LeafTy getWithDecrement(ScalarTy RHS) {
+  LeafTy getWithDecrement(ScalarTy RHS) const {
     return static_cast<LeafTy>(
         UnivariateLinearPolyBase(Value - RHS, UnivariateDim));
   }


        


More information about the llvm-commits mailing list