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

Chaoshuai Lu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 19 20:22:13 PDT 2021


lcs created this revision.
lcs added a reviewer: manmanren.
lcs requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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

This feels like a bug on the original change D22171 <https://reviews.llvm.org/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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112119

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


Index: clang/include/clang/AST/ExprObjC.h
===================================================================
--- clang/include/clang/AST/ExprObjC.h
+++ clang/include/clang/AST/ExprObjC.h
@@ -1706,7 +1706,7 @@
 
   /// 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());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112119.380846.patch
Type: text/x-patch
Size: 548 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211020/3fcdf566/attachment.bin>


More information about the cfe-commits mailing list