[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:24:03 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);
}
----------------
simon_tatham wrote:
> 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.
... ok, no, removing the `const_cast` now, I don't get a compile error. In that case there must have been something else weird about the version of the code where I had to add it, but I can't reconstruct what.
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