[clang] f1c9e7b - [ObjC Availability] Add missing const to getVersion function of ObjCAvailabilityCheckExpr class

Kyungwoo Lee via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 24 14:53:23 PST 2022


Author: Chaoshuai Lu
Date: 2022-01-24T14:52:57-08:00
New Revision: f1c9e7bdc921cec0cc3f61c19c4ac4a7f1bd8525

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

LOG: [ObjC Availability] Add missing const to getVersion function of ObjCAvailabilityCheckExpr class

Add missing const to `getVersion` function of `ObjCAvailabilityCheckExpr` class.

This feels like a bug on the original change D22171. We cannot really call this function from a const object pointer because the function is not marked as const.

This diff adds the missing const specifier to fix the issue.

Reviewed By: manmanren

Differential Revision: https://reviews.llvm.org/D112119

Added: 
    

Modified: 
    clang/include/clang/AST/ExprObjC.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/ExprObjC.h b/clang/include/clang/AST/ExprObjC.h
index b0f057dbaa02f..3b7ad8662ad95 100644
--- a/clang/include/clang/AST/ExprObjC.h
+++ b/clang/include/clang/AST/ExprObjC.h
@@ -1706,7 +1706,7 @@ class ObjCAvailabilityCheckExpr : public Expr {
 
   /// This may be '*', in which case this should fold to true.
   bool hasVersion() const { return !VersionToCheck.empty(); }
-  VersionTuple getVersion() { return VersionToCheck; }
+  VersionTuple getVersion() const { return VersionToCheck; }
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());


        


More information about the cfe-commits mailing list