[PATCH] D105498: [clang] Remove assumption about SourceLocation alignment.

Simon Tatham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 20 07:01:57 PDT 2021


simon_tatham added inline comments.


================
Comment at: clang/include/clang/AST/DeclObjC.h:208
   const ParmVarDecl *const *getParams() const {
-    return reinterpret_cast<const ParmVarDecl *const *>(ParamsAndSelLocs);
+    return const_cast<const ParmVarDecl *const *>(Params);
   }
----------------
tmatheson wrote:
> I don't think you need the `const_cast`
I put it in because I got a compile error otherwise!

It's because of the double indirection. You don't need a cast to turn a `Foo *` into a `const Foo *`. But here, we're turning a `Foo *` into a `const Bar *`, where `Foo` and `Bar` are pointer types to things of different constness.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105498/new/

https://reviews.llvm.org/D105498



More information about the cfe-commits mailing list