[PATCH] D62591: [OpenCL][PR42031] Prevent deducing addr space in type alias.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 5 07:47:50 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362611: [OpenCL][PR42031] Prevent deducing addr space in type alias. (authored by stulova, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D62591?vs=202721&id=203156#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62591/new/
https://reviews.llvm.org/D62591
Files:
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/SemaOpenCLCXX/address-space-deduction.cl
Index: cfe/trunk/lib/Sema/SemaType.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp
+++ cfe/trunk/lib/Sema/SemaType.cpp
@@ -7401,6 +7401,9 @@
(D.getContext() == DeclaratorContext::MemberContext &&
(!IsPointee &&
D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_static)) ||
+ // Do not deduce addr space of non-pointee in type alias because it
+ // doesn't define any object.
+ (D.getContext() == DeclaratorContext::AliasDeclContext && !IsPointee) ||
// 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.
Index: cfe/trunk/test/SemaOpenCLCXX/address-space-deduction.cl
===================================================================
--- cfe/trunk/test/SemaOpenCLCXX/address-space-deduction.cl
+++ cfe/trunk/test/SemaOpenCLCXX/address-space-deduction.cl
@@ -1,12 +1,26 @@
-//RUN: %clang_cc1 %s -cl-std=c++ -pedantic -ast-dump -verify
+//RUN: %clang_cc1 %s -cl-std=c++ -pedantic -ast-dump -verify | FileCheck %s
//expected-no-diagnostics
-//CHECK: |-VarDecl foo {{.*}} 'const __global int' constexpr cinit
+//CHECK: |-VarDecl {{.*}} foo 'const __global int'
constexpr int foo = 0;
class c {
public:
- //CHECK: `-VarDecl {{.*}} foo2 'const __global int' static constexpr cinit
+ //CHECK: `-VarDecl {{.*}} foo2 'const __global int'
static constexpr int foo2 = 0;
};
+
+struct c1 {};
+
+// We only deduce addr space in type alias in pointer types.
+//CHECK: TypeAliasDecl {{.*}} alias_c1 'c1'
+using alias_c1 = c1;
+//CHECK: TypeAliasDecl {{.*}} alias_c1_ptr '__generic c1 *'
+using alias_c1_ptr = c1 *;
+
+struct c2 {
+ alias_c1 y;
+ alias_c1_ptr ptr = &y;
+};
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62591.203156.patch
Type: text/x-patch
Size: 1823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190605/a73c5e82/attachment.bin>
More information about the llvm-commits
mailing list