[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)
commit6f7c536e083b61f02a69f6036d6564163c1783ad
tree0f3df6238bad009fff8f1ec30a23839d334ea470
parent27e5c212ee42bb3908d40d736b07762ae1fe98d0
[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

llvm-svn: 355609
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaCast.cpp
clang/test/CodeGenOpenCLCXX/address-space-castoperators.cpp [new file with mode: 0644]
clang/test/SemaCXX/address-space-conversion.cpp
clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
clang/test/SemaOpenCL/address-spaces.cl