[PATCH] Fix adress cast for C++ in SEMA

Samuel Antao sfantao at us.ibm.com
Wed May 13 10:23:47 PDT 2015


Add period to comment.


http://reviews.llvm.org/D7606

Files:
  lib/Sema/Sema.cpp

Index: lib/Sema/Sema.cpp
===================================================================
--- lib/Sema/Sema.cpp
+++ lib/Sema/Sema.cpp
@@ -369,6 +369,13 @@
     }
   }
 
+  // If we are casting pointers, we need to make sure we deal with address
+  // spaces properly.
+  if (Kind == CK_NoOp && ExprTy->isPointerType() && TypeTy->isPointerType() &&
+      ExprTy->getPointeeType().getAddressSpace() !=
+          TypeTy->getPointeeType().getAddressSpace())
+    Kind = CK_AddressSpaceConversion;
+
   return ImplicitCastExpr::Create(Context, Ty, Kind, E, BasePath, VK);
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7606.25708.patch
Type: text/x-patch
Size: 577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150513/1c7d2af3/attachment.bin>


More information about the cfe-commits mailing list