[PATCH] D57101: [AST] Fix addr space of result type for dereference operator

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 23 08:50:04 PST 2019


Anastasia updated this revision to Diff 183108.
Anastasia added a comment.

- Minot update to the comment.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57101/new/

https://reviews.llvm.org/D57101

Files:
  lib/Sema/SemaExpr.cpp
  test/SemaOpenCLCXX/address_space_overloading.cl


Index: test/SemaOpenCLCXX/address_space_overloading.cl
===================================================================
--- test/SemaOpenCLCXX/address_space_overloading.cl
+++ test/SemaOpenCLCXX/address_space_overloading.cl
@@ -1,12 +1,12 @@
 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=c++
 
-// FIXME: This test shouldn't trigger any errors.
+// expected-no-diagnostics 
 
 struct RetGlob {
   int dummy;
 };
 
-struct RetGen { //expected-error{{binding value of type '__generic RetGen' to reference to type 'RetGen' drops <<ERROR>> qualifiers}}
+struct RetGen {
   char dummy;
 };
 
@@ -19,5 +19,5 @@
   __local int *ArgLoc;
   RetGlob TestGlob = foo(ArgGlob);
   RetGen TestGen = foo(ArgGen);
-  TestGen = foo(ArgLoc); //expected-note{{in implicit copy assignment operator for 'RetGen' first required here}}
+  TestGen = foo(ArgLoc);
 }
Index: lib/Sema/SemaExpr.cpp
===================================================================
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -12997,6 +12997,8 @@
     Input = DefaultFunctionArrayLvalueConversion(Input.get());
     if (Input.isInvalid()) return ExprError();
     resultType = CheckIndirectionOperand(*this, Input.get(), VK, OpLoc);
+    // The result type of a dereferenced pointer is in the default addr space.
+    resultType = Context.removeAddrSpaceQualType(resultType);
     break;
   }
   case UO_Plus:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57101.183108.patch
Type: text/x-patch
Size: 1398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190123/da8ae796/attachment.bin>


More information about the cfe-commits mailing list