[PATCH] D60193: [OpenCL] Added addrspace_cast operator
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 3 04:46:40 PDT 2019
Anastasia created this revision.
Anastasia added reviewers: rjmccall, ebevhan.
Herald added a subscriber: yaxunl.
This change adds extra cast operator `addrspace_cast` described earlier in this RFC:
http://lists.llvm.org/pipermail/cfe-dev/2018-December/060546.html
This operator is intended for casting between pointers to objects in different address spaces and follows similar logic as `const_cast` in C++.
Example:
int* gen = ...;
global int* gl = addrspace_cast<global int*>(gen);
Note that functionality of casting pointers to different address spaces has been previously removed from all other cast operators and can only be currently done using C style casts.
This commit only enables this change for OpenCL, but if agreed it can be changed to apply to C++ too (it needs to be enabled as a valid keyword). However, for C++ it might need to be added as a Clang only extension?
https://reviews.llvm.org/D60193
Files:
include/clang/AST/ExprCXX.h
include/clang/AST/RecursiveASTVisitor.h
include/clang/Basic/DiagnosticParseKinds.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Basic/StmtNodes.td
include/clang/Basic/TokenKinds.def
include/clang/Serialization/ASTBitCodes.h
lib/AST/Expr.cpp
lib/AST/ExprCXX.cpp
lib/AST/ExprClassification.cpp
lib/AST/ExprConstant.cpp
lib/AST/ItaniumMangle.cpp
lib/AST/StmtPrinter.cpp
lib/AST/StmtProfile.cpp
lib/CodeGen/CGExpr.cpp
lib/Parse/ParseExpr.cpp
lib/Parse/ParseExprCXX.cpp
lib/Sema/SemaCast.cpp
lib/Sema/SemaExceptionSpec.cpp
lib/Sema/TreeTransform.h
lib/Serialization/ASTReaderStmt.cpp
lib/Serialization/ASTWriter.cpp
lib/Serialization/ASTWriterStmt.cpp
test/CodeGenOpenCLCXX/addrspace_cast.cl
test/SemaOpenCLCXX/addrspace_cast.cl
test/SemaOpenCLCXX/addrspace_cast_ast_dump.cl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60193.193467.patch
Type: text/x-patch
Size: 26738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190403/30b3c550/attachment-0001.bin>
More information about the cfe-commits
mailing list