]> granicus.if.org Git - clang/commit
[Sema][OpenCL] Make address space conversions a bit stricter.
authorAnastasia Stulova <anastasia.stulova@arm.com>
Wed, 8 May 2019 14:23:49 +0000 (14:23 +0000)
committerAnastasia Stulova <anastasia.stulova@arm.com>
Wed, 8 May 2019 14:23:49 +0000 (14:23 +0000)
commita5d10485549e0c79cd825773460453351afd2fb5
treee13de13ba79931a29f9754a90b900e01f51d1102
parentd8337696a9075f7e9b6555296fb9b9363cd87c91
[Sema][OpenCL] Make address space conversions a bit stricter.

The semantics for converting nested pointers between address
spaces are not very well defined. Some conversions which do not
really carry any meaning only produce warnings, and in some cases
warnings hide invalid conversions, such as 'global int*' to
'local float*'!

This patch changes the logic in checkPointerTypesForAssignment
and checkAddressSpaceCast to fail properly on implicit conversions
that should definitely not be permitted. We also dig deeper into the
pointer types and warn on explicit conversions where the address
space in a nested pointer changes, regardless of whether the address
space is compatible with the corresponding pointer nesting level
on the destination type.

Fixes PR39674!

Patch by ebevhan (Bevin Hansson)!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360258 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Sema/SemaCast.cpp
lib/Sema/SemaExpr.cpp
test/CodeGenOpenCL/numbered-address-space.cl
test/SemaOpenCL/address-spaces.cl
test/SemaOpenCL/event_t_overload.cl
test/SemaOpenCL/numbered-address-space.cl
test/SemaOpenCL/queue_t_overload.cl