]> granicus.if.org Git - clang/commitdiff
Use const_cast instead of a C cast. Safer, plus it suppresses a gcc warning.
authorJohn McCall <rjmccall@apple.com>
Wed, 21 Apr 2010 02:20:33 +0000 (02:20 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 21 Apr 2010 02:20:33 +0000 (02:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101982 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ExprObjC.h

index dfb842a3d0bac85e548ed621abc026e04eda6474..14e3d2cd13e73e189efb5628d5f28223e3f2324f 100644 (file)
@@ -706,8 +706,12 @@ public:
 
   arg_iterator arg_begin() { return getArgs(); }
   arg_iterator arg_end()   { return getArgs() + NumArgs; }
-  const_arg_iterator arg_begin() const { return (Stmt **)getArgs(); }
-  const_arg_iterator arg_end() const { return (Stmt **)getArgs() + NumArgs; }
+  const_arg_iterator arg_begin() const {
+    return const_cast<Stmt**>(getArgs());
+  }
+  const_arg_iterator arg_end() const {
+    return const_cast<Stmt**>(getArgs()) + NumArgs;
+  }
 };
 
 /// ObjCSuperExpr - Represents the "super" expression in Objective-C,