[PATCH] D102689: [C++] Ignore top-level qualifiers in casts

Ole Strohm via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 8 03:07:11 PDT 2021


olestrohm updated this revision to Diff 350560.
olestrohm retitled this revision from "[C++4OpenCL] Allow address space conversion in reinterpret_cast" to "[C++] Ignore top-level qualifiers in casts".
olestrohm edited the summary of this revision.
olestrohm added a comment.

I've added a check in the constructor for CastOperator that removes qualifiers for non-class, non-array types.
I had to add a check for ObjectiveC, since they seem to use qualifiers for a lot of language features,
but maybe a better solution would be to remove specific qualifiers instead?

This actually didn't cause that many changes in behaviour or error messages, maybe because the other casts
already have checks for this, but there was one change in a C++ test that looks a little strange after this patch,
but maybe that's alright.

Hopefully this is makes sense, but do suggest changes to the approach if you think there is a better one.


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

https://reviews.llvm.org/D102689

Files:
  clang/lib/Sema/SemaCast.cpp
  clang/test/CodeGenOpenCLCXX/reinterpret_cast.clcpp
  clang/test/SemaCXX/reinterpret-cast.cpp
  clang/test/SemaCXX/warn-reinterpret-base-class.cpp
  clang/test/SemaOpenCLCXX/addrspace_cast.clcpp
  clang/test/SemaOpenCLCXX/reinterpret-cast.clcpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102689.350560.patch
Type: text/x-patch
Size: 6246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210608/d4f91b36/attachment-0001.bin>


More information about the cfe-commits mailing list