summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2019-05-02 14:40:40 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2019-05-02 14:40:40 +0000
commitc38febbb182950aea135ddba6520186103110074 (patch)
tree884c395b1b49a0063ff99ef7bbe99176595d3ad5 /lib/Sema/SemaType.cpp
parent55766dd673f380c24949a424794764f62ce3242f (diff)
downloadclang-c38febbb182950aea135ddba6520186103110074.tar.gz
[OpenCL] Deduce static data members to __global addr space.
Similarly to static variables in OpenCL, static class data members should be deduced to __global addr space. Differential Revision: https://reviews.llvm.org/D61304 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 32e57eb925..3b25595a33 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -7308,8 +7308,10 @@ static void deduceOpenCLImplicitAddrSpace(TypeProcessingState &State,
// otherwise it will fail some sema check.
IsFuncReturnType || IsFuncType ||
// Do not deduce addr space for member types of struct, except the pointee
- // type of a pointer member type.
- (D.getContext() == DeclaratorContext::MemberContext && !IsPointee) ||
+ // type of a pointer member type or static data members.
+ (D.getContext() == DeclaratorContext::MemberContext &&
+ (!IsPointee &&
+ D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_static)) ||
// Do not deduce addr space for types used to define a typedef and the
// typedef itself, except the pointee type of a pointer type which is used
// to define the typedef.