[PATCH] D62591: [OpenCL][PR42031] Prevent deducing addr space in type alias.
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 29 06:57:31 PDT 2019
Anastasia created this revision.
Anastasia added reviewers: rjmccall, mantognini.
Herald added subscribers: ebevhan, yaxunl.
Similar to typedefs we shouldn't deduce addr space in type alias.
https://reviews.llvm.org/D62591
Files:
lib/Sema/SemaType.cpp
test/SemaOpenCLCXX/address-space-deduction.cl
Index: test/SemaOpenCLCXX/address-space-deduction.cl
===================================================================
--- test/SemaOpenCLCXX/address-space-deduction.cl
+++ test/SemaOpenCLCXX/address-space-deduction.cl
@@ -23,3 +23,13 @@
int foo[10];
xxx(&foo[0]);
}
+
+struct c1 {};
+
+// We don't deduce addr space in type alias.
+//CHECK: TypeAliasDecl {{.*}} referenced alias_c1 'c1'
+using alias_c1 = c1;
+
+struct c2 {
+ alias_c1 y;
+};
Index: lib/Sema/SemaType.cpp
===================================================================
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -7350,6 +7350,9 @@
(D.getContext() == DeclaratorContext::MemberContext &&
(!IsPointee &&
D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_static)) ||
+ // Do not deduce if we are in type alias because it doesn't define any
+ // object.
+ (D.getContext() == DeclaratorContext::AliasDeclContext) ||
// 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62591.201905.patch
Type: text/x-patch
Size: 1140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190529/a350141c/attachment.bin>
More information about the cfe-commits
mailing list