]> granicus.if.org Git - clang/commit
[Sema] Change addr space diagnostics in casts to follow C++ style.
authorAnastasia Stulova <anastasia.stulova@arm.com>
Thu, 7 Mar 2019 17:06:30 +0000 (17:06 +0000)
committerAnastasia Stulova <anastasia.stulova@arm.com>
Thu, 7 Mar 2019 17:06:30 +0000 (17:06 +0000)
commitd8ac2ca1f5fcf5661ec67d14a532f892603528f2
tree460affc57f3ea430258f882c4777915431a8281c
parentf384fbb54f9562470ad85f38d9e4a98b83297e45
[Sema] Change addr space diagnostics in casts to follow C++ style.

This change adds a new diagnostic for mismatching address spaces
to be used for C++ casts (only enabled in C style cast for now,
the rest will follow!).

The change extends C-style cast rules to account for address spaces.
It also adds a separate function for address space cast checking that
can be used to map from a separate address space cast operator
addrspace_cast (to be added as a follow up patch).

Note, that after this change clang will no longer allows arbitrary
address space conversions in reinterpret_casts because they can lead
to accidental errors. The implicit safe conversions would still be
allowed.

Differential Revision: https://reviews.llvm.org/D58346

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355609 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaCast.cpp
test/CodeGenOpenCLCXX/address-space-castoperators.cpp [new file with mode: 0644]
test/SemaCXX/address-space-conversion.cpp
test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
test/SemaOpenCL/address-spaces.cl