<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 10, 2016 at 10:24 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Fri, Apr 8, 2016 at 6:40 AM, Alexey Bader via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: bader<br>
Date: Fri Apr 8 08:40:33 2016<br>
New Revision: 265783<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=265783&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=265783&view=rev</a><br>
Log:<br>
[OpenCL] Complete image types support.<br>
<br>
I. Current implementation of images is not conformant to spec in the following points:<br>
1. It makes no distinction with respect to access qualifiers and therefore allows to use images with different access type interchangeably. The following code would compile just fine:<br>
<br>
void write_image(write_only image2d_t img);<br>
kernel void foo(read_only image2d_t img) { write_image(img); } // Accepted code<br>
<br>
which is disallowed according to s6.13.14.<br>
<br>
2. It discards access qualifier on generated code, which leads to generated code for the above example:<br>
<br>
call void @write_image(%opencl.image2d_t* %img);<br>
<br>
In OpenCL2.0 however we can have different calls into write_image with read_only and wite_only images.<br>
Also generally following compiler steps have no easy way to take different path depending on the image access: linking to the right implementation of image types, performing IR opts and backend codegen differently.<br>
<br>
3. Image types are language keywords and can't be redeclared s6.1.9, which can happen currently as they are just typedef names.<br>
4. Default access qualifier read_only is to be added if not provided explicitly.<br>
<br>
II. This patch corrects the above points as follows:<br>
1. All images are encapsulated into a separate .def file that is inserted in different points where image handling is required. This avoid a lot of code repetition as all images are handled the same way in the code with no distinction of their exact type.<br>
2. The Cartesian product of image types and image access qualifiers is added to the builtin types. This simplifies a lot handling of access type mismatch as no operations are allowed by default on distinct Builtin types. Also spec intended access qualifier as special type qualifier that are combined with an image type to form a distinct type (see statement above - images can't be created w/o access qualifiers).<br>
3. Improves testing of images in Clang.<br>
<br>
Author: Anastasia Stulova<br>
Reviewers: bader, mgrang.<br>
Subscribers: pxli168, pekka.jaaskelainen, yaxunl.<br>
Differential Revision: <a href="http://reviews.llvm.org/D17821" rel="noreferrer" target="_blank">http://reviews.llvm.org/D17821</a><br>
<br>
Added:<br>
cfe/trunk/include/clang/AST/OpenCLImageTypes.def<br>
cfe/trunk/test/CodeGenOpenCL/<a href="http://images.cl" rel="noreferrer" target="_blank">images.cl</a><br>
cfe/trunk/test/SemaOpenCL/<a href="http://images.cl" rel="noreferrer" target="_blank">images.cl</a><br>
Modified:<br>
cfe/trunk/include/clang/AST/ASTContext.h<br>
cfe/trunk/include/clang/AST/BuiltinTypes.def<br>
cfe/trunk/include/clang/AST/Type.h<br>
cfe/trunk/include/clang/Basic/Specifiers.h<br>
cfe/trunk/include/clang/Basic/TokenKinds.def<br>
cfe/trunk/include/clang/Sema/DeclSpec.h<br>
cfe/trunk/include/clang/Serialization/ASTBitCodes.h<br>
cfe/trunk/lib/AST/ASTContext.cpp<br>
cfe/trunk/lib/AST/ASTImporter.cpp<br>
cfe/trunk/lib/AST/ExprConstant.cpp<br>
cfe/trunk/lib/AST/ItaniumMangle.cpp<br>
cfe/trunk/lib/AST/MicrosoftMangle.cpp<br>
cfe/trunk/lib/AST/NSAPI.cpp<br>
cfe/trunk/lib/AST/Type.cpp<br>
cfe/trunk/lib/AST/TypeLoc.cpp<br>
cfe/trunk/lib/Analysis/PrintfFormatString.cpp<br>
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
cfe/trunk/lib/CodeGen/CGDebugInfo.h<br>
cfe/trunk/lib/CodeGen/CGOpenCLRuntime.cpp<br>
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp<br>
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp<br>
cfe/trunk/lib/Index/USRGeneration.cpp<br>
cfe/trunk/lib/Parse/ParseDecl.cpp<br>
cfe/trunk/lib/Parse/ParseExpr.cpp<br>
cfe/trunk/lib/Parse/ParseTentative.cpp<br>
cfe/trunk/lib/Sema/DeclSpec.cpp<br>
cfe/trunk/lib/Sema/Sema.cpp<br>
cfe/trunk/lib/Sema/SemaExpr.cpp<br>
cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp<br>
cfe/trunk/lib/Sema/SemaType.cpp<br>
cfe/trunk/lib/Serialization/ASTCommon.cpp<br>
cfe/trunk/lib/Serialization/ASTReader.cpp<br>
cfe/trunk/test/CodeGenOpenCL/<a href="http://opencl_types.cl" rel="noreferrer" target="_blank">opencl_types.cl</a><br>
cfe/trunk/test/SemaOpenCL/<a href="http://invalid-access-qualifier.cl" rel="noreferrer" target="_blank">invalid-access-qualifier.cl</a><br>
cfe/trunk/test/SemaOpenCL/<a href="http://invalid-image.cl" rel="noreferrer" target="_blank">invalid-image.cl</a><br>
cfe/trunk/test/SemaOpenCL/<a href="http://invalid-kernel-parameters.cl" rel="noreferrer" target="_blank">invalid-kernel-parameters.cl</a><br>
cfe/trunk/tools/libclang/CIndex.cpp<br>
<br>
Modified: cfe/trunk/include/clang/AST/ASTContext.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/ASTContext.h (original)<br>
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Apr 8 08:40:33 2016<br>
@@ -902,11 +902,9 @@ public:<br>
CanQualType PseudoObjectTy, ARCUnbridgedCastTy;<br>
CanQualType ObjCBuiltinIdTy, ObjCBuiltinClassTy, ObjCBuiltinSelTy;<br>
CanQualType ObjCBuiltinBoolTy;<br>
- CanQualType OCLImage1dTy, OCLImage1dArrayTy, OCLImage1dBufferTy;<br>
- CanQualType OCLImage2dTy, OCLImage2dArrayTy, OCLImage2dDepthTy;<br>
- CanQualType OCLImage2dArrayDepthTy, OCLImage2dMSAATy, OCLImage2dArrayMSAATy;<br>
- CanQualType OCLImage2dMSAADepthTy, OCLImage2dArrayMSAADepthTy;<br>
- CanQualType OCLImage3dTy;<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ CanQualType SingletonId;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
CanQualType OCLSamplerTy, OCLEventTy, OCLClkEventTy;<br>
CanQualType OCLQueueTy, OCLNDRangeTy, OCLReserveIDTy;<br>
CanQualType OMPArraySectionTy;<br>
<br>
Modified: cfe/trunk/include/clang/AST/BuiltinTypes.def<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/BuiltinTypes.def?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/BuiltinTypes.def?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/BuiltinTypes.def (original)<br>
+++ cfe/trunk/include/clang/AST/BuiltinTypes.def Fri Apr 8 08:40:33 2016<br>
@@ -154,20 +154,6 @@ BUILTIN_TYPE(ObjCClass, ObjCBuiltinClass<br>
// type is a typedef of a PointerType to this.<br>
BUILTIN_TYPE(ObjCSel, ObjCBuiltinSelTy)<br>
<br>
-// OpenCL image types.<br>
-BUILTIN_TYPE(OCLImage1d, OCLImage1dTy)<br>
-BUILTIN_TYPE(OCLImage1dArray, OCLImage1dArrayTy)<br>
-BUILTIN_TYPE(OCLImage1dBuffer, OCLImage1dBufferTy)<br>
-BUILTIN_TYPE(OCLImage2d, OCLImage2dTy)<br>
-BUILTIN_TYPE(OCLImage2dArray, OCLImage2dArrayTy)<br>
-BUILTIN_TYPE(OCLImage2dDepth, OCLImage2dDepthTy)<br>
-BUILTIN_TYPE(OCLImage2dArrayDepth, OCLImage2dArrayDepthTy)<br>
-BUILTIN_TYPE(OCLImage2dMSAA, OCLImage2dMSAATy)<br>
-BUILTIN_TYPE(OCLImage2dArrayMSAA, OCLImage2dArrayMSAATy)<br>
-BUILTIN_TYPE(OCLImage2dMSAADepth, OCLImage2dMSAADepthTy)<br>
-BUILTIN_TYPE(OCLImage2dArrayMSAADepth, OCLImage2dArrayMSAADepthTy)<br>
-BUILTIN_TYPE(OCLImage3d, OCLImage3dTy)<br>
-<br>
// OpenCL sampler_t.<br>
BUILTIN_TYPE(OCLSampler, OCLSamplerTy)<br>
<br>
<br>
Added: cfe/trunk/include/clang/AST/OpenCLImageTypes.def<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenCLImageTypes.def?rev=265783&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenCLImageTypes.def?rev=265783&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/OpenCLImageTypes.def (added)<br>
+++ cfe/trunk/include/clang/AST/OpenCLImageTypes.def Fri Apr 8 08:40:33 2016<br>
@@ -0,0 +1,82 @@<br>
+//===-- OpenCLImageTypes.def - Metadata about BuiltinTypes ------*- C++ -*-===//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+// This file extends builtin types database with OpenCL image singleton types.<br>
+// Custom code should define one of those two macros:<br>
+// GENERIC_IMAGE_TYPE(Type, Id) - a generic image with its Id without an<br>
+// access type<br>
+// IMAGE_TYPE(Type, Id, SingletonId, AccessType, CGSuffix) - an image type<br>
+// with given ID, singleton ID access type and a codegen suffix<br>
+<br>
+#ifdef GENERIC_IMAGE_TYPE<br>
+<br>
+#define IMAGE_READ_TYPE(Type, Id) GENERIC_IMAGE_TYPE(Type, Id)<br>
+#define IMAGE_WRITE_TYPE(Type, Id)<br>
+#define IMAGE_READ_WRITE_TYPE(Type, Id)<br>
+<br>
+#else<br>
+<br>
+#ifndef IMAGE_READ_TYPE<br>
+#define IMAGE_READ_TYPE(Type, Id) \<br>
+ IMAGE_TYPE(Type, Id##RO, Id##ROTy, read_only, ro)<br>
+#endif<br>
+#ifndef IMAGE_WRITE_TYPE<br>
+#define IMAGE_WRITE_TYPE(Type, Id) \<br>
+ IMAGE_TYPE(Type, Id##WO, Id##WOTy, write_only, wo)<br>
+#endif<br>
+#ifndef IMAGE_READ_WRITE_TYPE<br>
+#define IMAGE_READ_WRITE_TYPE(Type, Id) \<br>
+ IMAGE_TYPE(Type, Id##RW, Id##RWTy, read_write, rw)<br>
+#endif<br>
+<br>
+#endif<br>
+<br>
+IMAGE_READ_TYPE(image1d, OCLImage1d)<br>
+IMAGE_READ_TYPE(image1d_array, OCLImage1dArray)<br>
+IMAGE_READ_TYPE(image1d_buffer, OCLImage1dBuffer)<br>
+IMAGE_READ_TYPE(image2d, OCLImage2d)<br>
+IMAGE_READ_TYPE(image2d_array, OCLImage2dArray)<br>
+IMAGE_READ_TYPE(image2d_depth, OCLImage2dDepth)<br>
+IMAGE_READ_TYPE(image2d_array_depth, OCLImage2dArrayDepth)<br>
+IMAGE_READ_TYPE(image2d_msaa, OCLImage2dMSAA)<br>
+IMAGE_READ_TYPE(image2d_array_msaa, OCLImage2dArrayMSAA)<br>
+IMAGE_READ_TYPE(image2d_msaa_depth, OCLImage2dMSAADepth)<br>
+IMAGE_READ_TYPE(image2d_array_msaa_depth, OCLImage2dArrayMSAADepth)<br>
+IMAGE_READ_TYPE(image3d, OCLImage3d)<br>
+<br>
+IMAGE_WRITE_TYPE(image1d, OCLImage1d)<br>
+IMAGE_WRITE_TYPE(image1d_array, OCLImage1dArray)<br>
+IMAGE_WRITE_TYPE(image1d_buffer, OCLImage1dBuffer)<br>
+IMAGE_WRITE_TYPE(image2d, OCLImage2d)<br>
+IMAGE_WRITE_TYPE(image2d_array, OCLImage2dArray)<br>
+IMAGE_WRITE_TYPE(image2d_depth, OCLImage2dDepth)<br>
+IMAGE_WRITE_TYPE(image2d_array_depth, OCLImage2dArrayDepth)<br>
+IMAGE_WRITE_TYPE(image2d_msaa, OCLImage2dMSAA)<br>
+IMAGE_WRITE_TYPE(image2d_array_msaa, OCLImage2dArrayMSAA)<br>
+IMAGE_WRITE_TYPE(image2d_msaa_depth, OCLImage2dMSAADepth)<br>
+IMAGE_WRITE_TYPE(image2d_array_msaa_depth, OCLImage2dArrayMSAADepth)<br>
+IMAGE_WRITE_TYPE(image3d, OCLImage3d)<br>
+<br>
+IMAGE_READ_WRITE_TYPE(image1d, OCLImage1d)<br>
+IMAGE_READ_WRITE_TYPE(image1d_array, OCLImage1dArray)<br>
+IMAGE_READ_WRITE_TYPE(image1d_buffer, OCLImage1dBuffer)<br>
+IMAGE_READ_WRITE_TYPE(image2d, OCLImage2d)<br>
+IMAGE_READ_WRITE_TYPE(image2d_array, OCLImage2dArray)<br>
+IMAGE_READ_WRITE_TYPE(image2d_depth, OCLImage2dDepth)<br>
+IMAGE_READ_WRITE_TYPE(image2d_array_depth, OCLImage2dArrayDepth)<br>
+IMAGE_READ_WRITE_TYPE(image2d_msaa, OCLImage2dMSAA)<br>
+IMAGE_READ_WRITE_TYPE(image2d_array_msaa, OCLImage2dArrayMSAA)<br>
+IMAGE_READ_WRITE_TYPE(image2d_msaa_depth, OCLImage2dMSAADepth)<br>
+IMAGE_READ_WRITE_TYPE(image2d_array_msaa_depth, OCLImage2dArrayMSAADepth)<br>
+IMAGE_READ_WRITE_TYPE(image3d, OCLImage3d)<br>
+<br>
+#undef IMAGE_TYPE<br>
+#undef GENERIC_IMAGE_TYPE<br>
+#undef IMAGE_READ_TYPE<br>
+#undef IMAGE_WRITE_TYPE<br>
+#undef IMAGE_READ_WRITE_TYPE<br>
\ No newline at end of file<br>
<br>
Modified: cfe/trunk/include/clang/AST/Type.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/Type.h (original)<br>
+++ cfe/trunk/include/clang/AST/Type.h Fri Apr 8 08:40:33 2016<br>
@@ -1705,18 +1705,9 @@ public:<br>
bool isNullPtrType() const; // C++0x nullptr_t<br>
bool isAtomicType() const; // C11 _Atomic()<br>
<br>
- bool isImage1dT() const; // OpenCL image1d_t<br>
- bool isImage1dArrayT() const; // OpenCL image1d_array_t<br>
- bool isImage1dBufferT() const; // OpenCL image1d_buffer_t<br>
- bool isImage2dT() const; // OpenCL image2d_t<br>
- bool isImage2dArrayT() const; // OpenCL image2d_array_t<br>
- bool isImage2dDepthT() const; // OpenCL image_2d_depth_t<br>
- bool isImage2dArrayDepthT() const; // OpenCL image_2d_array_depth_t<br>
- bool isImage2dMSAAT() const; // OpenCL image_2d_msaa_t<br>
- bool isImage2dArrayMSAAT() const; // OpenCL image_2d_array_msaa_t<br>
- bool isImage2dMSAATDepth() const; // OpenCL image_2d_msaa_depth_t<br>
- bool isImage2dArrayMSAATDepth() const; // OpenCL image_2d_array_msaa_depth_t<br>
- bool isImage3dT() const; // OpenCL image3d_t<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ bool is##Id##Type() const;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
<br>
bool isImageType() const; // Any OpenCL image type<br>
<br>
@@ -2017,6 +2008,10 @@ template <> inline const Class##Type *Ty<br>
class BuiltinType : public Type {<br>
public:<br>
enum Kind {<br>
+// OpenCL image types<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id,<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
+// All other builtin types<br>
#define BUILTIN_TYPE(Id, SingletonId) Id,<br>
#define LAST_BUILTIN_TYPE(Id) LastKind = Id<br>
#include "clang/AST/BuiltinTypes.def"<br>
@@ -5557,53 +5552,11 @@ inline bool Type::isObjCBuiltinType() co<br>
return isObjCIdType() || isObjCClassType() || isObjCSelType();<br>
}<br>
<br>
-inline bool Type::isImage1dT() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage1d);<br>
-}<br>
-<br>
-inline bool Type::isImage1dArrayT() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage1dArray);<br>
-}<br>
-<br>
-inline bool Type::isImage1dBufferT() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage1dBuffer);<br>
-}<br>
-<br>
-inline bool Type::isImage2dT() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage2d);<br>
-}<br>
-<br>
-inline bool Type::isImage2dArrayT() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage2dArray);<br>
-}<br>
-<br>
-inline bool Type::isImage2dDepthT() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage2dDepth);<br>
-}<br>
-<br>
-inline bool Type::isImage2dArrayDepthT() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage2dArrayDepth);<br>
-}<br>
-<br>
-inline bool Type::isImage2dMSAAT() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage2dMSAA);<br>
-}<br>
-<br>
-inline bool Type::isImage2dArrayMSAAT() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage2dArrayMSAA);<br>
-}<br>
-<br>
-inline bool Type::isImage2dMSAATDepth() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage2dMSAADepth);<br>
-}<br>
-<br>
-inline bool Type::isImage2dArrayMSAATDepth() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage2dArrayMSAADepth);<br>
-}<br>
-<br>
-inline bool Type::isImage3dT() const {<br>
- return isSpecificBuiltinType(BuiltinType::OCLImage3d);<br>
-}<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ inline bool Type::is##Id##Type() const { \<br>
+ return isSpecificBuiltinType(BuiltinType::Id); \<br>
+ }<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
<br>
inline bool Type::isSamplerT() const {<br>
return isSpecificBuiltinType(BuiltinType::OCLSampler);<br>
@@ -5630,11 +5583,10 @@ inline bool Type::isReserveIDT() const {<br>
}<br>
<br>
inline bool Type::isImageType() const {<br>
- return isImage3dT() || isImage2dT() || isImage2dArrayT() ||<br>
- isImage2dDepthT() || isImage2dArrayDepthT() || isImage2dMSAAT() ||<br>
- isImage2dArrayMSAAT() || isImage2dMSAATDepth() ||<br>
- isImage2dArrayMSAATDepth() || isImage1dT() || isImage1dArrayT() ||<br>
- isImage1dBufferT();<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() ||<br>
+ return<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
+ 0; // end boolean or operation<br>
}<br>
<br>
inline bool Type::isPipeType() const {<br>
<br>
Modified: cfe/trunk/include/clang/Basic/Specifiers.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/Specifiers.h (original)<br>
+++ cfe/trunk/include/clang/Basic/Specifiers.h Fri Apr 8 08:40:33 2016<br>
@@ -73,9 +73,11 @@ namespace clang {<br>
TST_auto_type, // __auto_type extension<br>
TST_unknown_anytype, // __unknown_anytype extension<br>
TST_atomic, // C11 _Atomic<br>
- TST_error // erroneous type<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) TST_##ImgType##_t, // OpenCL image types<br>
+#include "clang/AST/OpenCLImageTypes.def"<br></blockquote><div><br></div></div></div><div><div>This is a layering violation. It's not OK for a Basic/ header to include an AST/ header. (This breaks the modules build.) Please fix. Maybe OpenCLImageTypes.def should be in Basic/?</div></div><div><div class="h5"><div> </div></div></div></div></div></div></blockquote><div><br></div><div>Hi Richard,</div><div><br></div><div>Sorry about breaking the build. I prepared a patch which moves OpenCLImageTypes.def file from include/clang/AST directory to include/clang/Basic (see <a href="http://reviews.llvm.org/D18954">http://reviews.llvm.org/D18954</a>).</div><div>I passed regular build + lit tests, but I was not able to verify that this patch fixes the modules build due to some technical issues - clang++ seems to be broken.</div><div>I didn't find any instructions on how to test the modules build, so I tried to reproduce the steps from these logs: <a href="http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/14367">http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/14367</a>.</div><div>Could you check it fixes the modules build, please?<br></div><div><br></div><div>BTW. I didn't get any notification before your email that my commit broke the build. Should I subscribe to another mailing list?</div><div><br></div><div>Thanks,</div><div>Alexey</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ TST_error // erroneous type<br>
};<br>
-<br>
+<br>
/// \brief Structure that packs information about the type specifiers that<br>
/// were written in a particular type specifier sequence.<br>
struct WrittenBuiltinSpecs {<br>
<br>
Modified: cfe/trunk/include/clang/Basic/TokenKinds.def<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)<br>
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Fri Apr 8 08:40:33 2016<br>
@@ -518,6 +518,8 @@ ALIAS("read_write", __read_write , KE<br>
// OpenCL builtins<br>
KEYWORD(__builtin_astype , KEYOPENCL)<br>
KEYWORD(vec_step , KEYOPENCL|KEYALTIVEC|KEYZVECTOR)<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) KEYWORD(ImgType##_t, KEYOPENCL)<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
<br>
// OpenMP Type Traits<br>
KEYWORD(__builtin_omp_required_simd_align, KEYALL)<br>
<br>
Modified: cfe/trunk/include/clang/Sema/DeclSpec.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)<br>
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Fri Apr 8 08:40:33 2016<br>
@@ -299,6 +299,9 @@ public:<br>
static const TST TST_auto_type = clang::TST_auto_type;<br>
static const TST TST_unknown_anytype = clang::TST_unknown_anytype;<br>
static const TST TST_atomic = clang::TST_atomic;<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) \<br>
+ static const TST TST_##ImgType##_t = clang::TST_##ImgType##_t;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
static const TST TST_error = clang::TST_error;<br>
<br>
// type-qualifiers<br>
<br>
Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)<br>
+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Fri Apr 8 08:40:33 2016<br>
@@ -784,44 +784,24 @@ namespace clang {<br>
PREDEF_TYPE_PSEUDO_OBJECT = 35,<br>
/// \brief The placeholder type for builtin functions.<br>
PREDEF_TYPE_BUILTIN_FN = 36,<br>
- /// \brief OpenCL 1d image type.<br>
- PREDEF_TYPE_IMAGE1D_ID = 37,<br>
- /// \brief OpenCL 1d image array type.<br>
- PREDEF_TYPE_IMAGE1D_ARR_ID = 38,<br>
- /// \brief OpenCL 1d image buffer type.<br>
- PREDEF_TYPE_IMAGE1D_BUFF_ID = 39,<br>
- /// \brief OpenCL 2d image type.<br>
- PREDEF_TYPE_IMAGE2D_ID = 40,<br>
- /// \brief OpenCL 2d image array type.<br>
- PREDEF_TYPE_IMAGE2D_ARR_ID = 41,<br>
- /// \brief OpenCL 2d image depth type.<br>
- PREDEF_TYPE_IMAGE2D_DEP_ID = 42,<br>
- /// \brief OpenCL 2d image array depth type.<br>
- PREDEF_TYPE_IMAGE2D_ARR_DEP_ID = 43,<br>
- /// \brief OpenCL 2d image MSAA type.<br>
- PREDEF_TYPE_IMAGE2D_MSAA_ID = 44,<br>
- /// \brief OpenCL 2d image array MSAA type.<br>
- PREDEF_TYPE_IMAGE2D_ARR_MSAA_ID = 45,<br>
- /// \brief OpenCL 2d image MSAA depth type.<br>
- PREDEF_TYPE_IMAGE2D_MSAA_DEP_ID = 46,<br>
- /// \brief OpenCL 2d image array MSAA depth type.<br>
- PREDEF_TYPE_IMAGE2D_ARR_MSAA_DEPTH_ID = 47,<br>
- /// \brief OpenCL 3d image type.<br>
- PREDEF_TYPE_IMAGE3D_ID = 48,<br>
/// \brief OpenCL event type.<br>
- PREDEF_TYPE_EVENT_ID = 49,<br>
+ PREDEF_TYPE_EVENT_ID = 37,<br>
/// \brief OpenCL clk event type.<br>
- PREDEF_TYPE_CLK_EVENT_ID = 50,<br>
+ PREDEF_TYPE_CLK_EVENT_ID = 38,<br>
/// \brief OpenCL sampler type.<br>
- PREDEF_TYPE_SAMPLER_ID = 51,<br>
+ PREDEF_TYPE_SAMPLER_ID = 39,<br>
/// \brief OpenCL queue type.<br>
- PREDEF_TYPE_QUEUE_ID = 52,<br>
+ PREDEF_TYPE_QUEUE_ID = 40,<br>
/// \brief OpenCL ndrange type.<br>
- PREDEF_TYPE_NDRANGE_ID = 53,<br>
+ PREDEF_TYPE_NDRANGE_ID = 41,<br>
/// \brief OpenCL reserve_id type.<br>
- PREDEF_TYPE_RESERVE_ID_ID = 54,<br>
+ PREDEF_TYPE_RESERVE_ID_ID = 42,<br>
/// \brief The placeholder type for OpenMP array section.<br>
- PREDEF_TYPE_OMP_ARRAY_SECTION = 55<br>
+ PREDEF_TYPE_OMP_ARRAY_SECTION = 43,<br>
+ /// \brief OpenCL image types with auto numeration<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ PREDEF_TYPE_##Id##_ID,<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
};<br>
<br>
/// \brief The number of predefined type IDs that are reserved for<br>
<br>
Modified: cfe/trunk/lib/AST/ASTContext.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/ASTContext.cpp (original)<br>
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Apr 8 08:40:33 2016<br>
@@ -1090,20 +1090,10 @@ void ASTContext::InitBuiltinTypes(const<br>
InitBuiltinType(ObjCBuiltinClassTy, BuiltinType::ObjCClass);<br>
InitBuiltinType(ObjCBuiltinSelTy, BuiltinType::ObjCSel);<br>
<br>
- if (LangOpts.OpenCL) {<br>
- InitBuiltinType(OCLImage1dTy, BuiltinType::OCLImage1d);<br>
- InitBuiltinType(OCLImage1dArrayTy, BuiltinType::OCLImage1dArray);<br>
- InitBuiltinType(OCLImage1dBufferTy, BuiltinType::OCLImage1dBuffer);<br>
- InitBuiltinType(OCLImage2dTy, BuiltinType::OCLImage2d);<br>
- InitBuiltinType(OCLImage2dArrayTy, BuiltinType::OCLImage2dArray);<br>
- InitBuiltinType(OCLImage2dDepthTy, BuiltinType::OCLImage2dDepth);<br>
- InitBuiltinType(OCLImage2dArrayDepthTy, BuiltinType::OCLImage2dArrayDepth);<br>
- InitBuiltinType(OCLImage2dMSAATy, BuiltinType::OCLImage2dMSAA);<br>
- InitBuiltinType(OCLImage2dArrayMSAATy, BuiltinType::OCLImage2dArrayMSAA);<br>
- InitBuiltinType(OCLImage2dMSAADepthTy, BuiltinType::OCLImage2dMSAADepth);<br>
- InitBuiltinType(OCLImage2dArrayMSAADepthTy,<br>
- BuiltinType::OCLImage2dArrayMSAADepth);<br>
- InitBuiltinType(OCLImage3dTy, BuiltinType::OCLImage3d);<br>
+ if (LangOpts.OpenCL) {<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ InitBuiltinType(SingletonId, BuiltinType::Id);<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
<br>
InitBuiltinType(OCLSamplerTy, BuiltinType::OCLSampler);<br>
InitBuiltinType(OCLEventTy, BuiltinType::OCLEvent);<br>
@@ -1681,18 +1671,10 @@ TypeInfo ASTContext::getTypeInfoImpl(con<br>
case BuiltinType::OCLQueue:<br>
case BuiltinType::OCLNDRange:<br>
case BuiltinType::OCLReserveID:<br>
- case BuiltinType::OCLImage1d:<br>
- case BuiltinType::OCLImage1dArray:<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- case BuiltinType::OCLImage2d:<br>
- case BuiltinType::OCLImage2dArray:<br>
- case BuiltinType::OCLImage2dDepth:<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- case BuiltinType::OCLImage3d:<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
+<br>
// Currently these types are pointers to opaque types.<br>
Width = Target->getPointerWidth(0);<br>
Align = Target->getPointerAlign(0);<br>
@@ -5517,18 +5499,9 @@ static char getObjCEncodingForPrimitiveK<br>
llvm_unreachable("@encoding ObjC primitive type");<br>
<br>
// OpenCL and placeholder types don't need @encodings.<br>
- case BuiltinType::OCLImage1d:<br>
- case BuiltinType::OCLImage1dArray:<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- case BuiltinType::OCLImage2d:<br>
- case BuiltinType::OCLImage2dArray:<br>
- case BuiltinType::OCLImage2dDepth:<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- case BuiltinType::OCLImage3d:<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLEvent:<br>
case BuiltinType::OCLClkEvent:<br>
case BuiltinType::OCLQueue:<br>
<br>
Modified: cfe/trunk/lib/AST/ASTImporter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)<br>
+++ cfe/trunk/lib/AST/ASTImporter.cpp Fri Apr 8 08:40:33 2016<br>
@@ -1509,6 +1509,10 @@ QualType ASTNodeImporter::VisitType(cons<br>
<br>
QualType ASTNodeImporter::VisitBuiltinType(const BuiltinType *T) {<br>
switch (T->getKind()) {<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id: \<br>
+ return Importer.getToContext().SingletonId;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
#define SHARED_SINGLETON_TYPE(Expansion)<br>
#define BUILTIN_TYPE(Id, SingletonId) \<br>
case BuiltinType::Id: return Importer.getToContext().SingletonId;<br>
<br>
Modified: cfe/trunk/lib/AST/ExprConstant.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)<br>
+++ cfe/trunk/lib/AST/ExprConstant.cpp Fri Apr 8 08:40:33 2016<br>
@@ -6301,18 +6301,9 @@ static int EvaluateBuiltinClassifyType(c<br>
case BuiltinType::ObjCId:<br>
case BuiltinType::ObjCClass:<br>
case BuiltinType::ObjCSel:<br>
- case BuiltinType::OCLImage1d:<br>
- case BuiltinType::OCLImage1dArray:<br>
- case BuiltinType::OCLImage2d:<br>
- case BuiltinType::OCLImage2dArray:<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- case BuiltinType::OCLImage2dDepth:<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- case BuiltinType::OCLImage3d:<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
case BuiltinType::OCLEvent:<br>
case BuiltinType::OCLClkEvent:<br>
<br>
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)<br>
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Fri Apr 8 08:40:33 2016<br>
@@ -2001,6 +2001,7 @@ void CXXNameMangler::mangleType(const Bu<br>
// ::= Ds # char16_t<br>
// ::= Dn # std::nullptr_t (i.e., decltype(nullptr))<br>
// ::= u <source-name> # vendor extended type<br>
+ std::string type_name;<br>
switch (T->getKind()) {<br>
case BuiltinType::Void:<br>
Out << 'v';<br>
@@ -2091,42 +2092,12 @@ void CXXNameMangler::mangleType(const Bu<br>
case BuiltinType::ObjCSel:<br>
Out << "13objc_selector";<br>
break;<br>
- case BuiltinType::OCLImage1d:<br>
- Out << "11ocl_image1d";<br>
- break;<br>
- case BuiltinType::OCLImage1dArray:<br>
- Out << "16ocl_image1darray";<br>
- break;<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- Out << "17ocl_image1dbuffer";<br>
- break;<br>
- case BuiltinType::OCLImage2d:<br>
- Out << "11ocl_image2d";<br>
- break;<br>
- case BuiltinType::OCLImage2dArray:<br>
- Out << "16ocl_image2darray";<br>
- break;<br>
- case BuiltinType::OCLImage2dDepth:<br>
- Out << "16ocl_image2ddepth";<br>
- break;<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- Out << "21ocl_image2darraydepth";<br>
- break;<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- Out << "15ocl_image2dmsaa";<br>
- break;<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- Out << "20ocl_image2darraymsaa";<br>
- break;<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- Out << "20ocl_image2dmsaadepth";<br>
- break;<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- Out << "25ocl_image2darraymsaadepth";<br>
- break;<br>
- case BuiltinType::OCLImage3d:<br>
- Out << "11ocl_image3d";<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id: \<br>
+ type_name = "ocl_" #ImgType "_" #Suffix; \<br>
+ Out << type_name.size() << type_name; \<br>
break;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
Out << "11ocl_sampler";<br>
break;<br>
<br>
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)<br>
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri Apr 8 08:40:33 2016<br>
@@ -1717,54 +1717,11 @@ void MicrosoftCXXNameMangler::mangleType<br>
mangleArtificalTagType(TTK_Struct, "objc_selector");<br>
break;<br>
<br>
- case BuiltinType::OCLImage1d:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image1d");<br>
- break;<br>
- case BuiltinType::OCLImage1dArray:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image1darray");<br>
- break;<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image1dbuffer");<br>
- break;<br>
- case BuiltinType::OCLImage2d:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image2d");<br>
- break;<br>
- case BuiltinType::OCLImage2dArray:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image2darray");<br>
- break;<br>
- case BuiltinType::OCLImage2dDepth:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image2ddepth");<br>
- break;<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image2darraydepth");<br>
- break;<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image2dmsaa");<br>
- break;<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image2darraymsaa");<br>
- break;<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image2dmsaadepth");<br>
- break;<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image2darraymsaadepth");<br>
- break;<br>
- case BuiltinType::OCLImage3d:<br>
- Out << "PA";<br>
- mangleArtificalTagType(TTK_Struct, "ocl_image3d");<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id: \<br>
+ Out << "PAUocl_" #ImgType "_" #Suffix "@@"; \<br>
break;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
Out << "PA";<br>
mangleArtificalTagType(TTK_Struct, "ocl_sampler");<br>
<br>
Modified: cfe/trunk/lib/AST/NSAPI.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NSAPI.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NSAPI.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/NSAPI.cpp (original)<br>
+++ cfe/trunk/lib/AST/NSAPI.cpp Fri Apr 8 08:40:33 2016<br>
@@ -445,18 +445,9 @@ NSAPI::getNSNumberFactoryMethodKind(Qual<br>
case BuiltinType::ObjCClass:<br>
case BuiltinType::ObjCId:<br>
case BuiltinType::ObjCSel:<br>
- case BuiltinType::OCLImage1d:<br>
- case BuiltinType::OCLImage1dArray:<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- case BuiltinType::OCLImage2d:<br>
- case BuiltinType::OCLImage2dArray:<br>
- case BuiltinType::OCLImage2dDepth:<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- case BuiltinType::OCLImage3d:<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
case BuiltinType::OCLEvent:<br>
case BuiltinType::OCLClkEvent:<br>
<br>
Modified: cfe/trunk/lib/AST/Type.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/Type.cpp (original)<br>
+++ cfe/trunk/lib/AST/Type.cpp Fri Apr 8 08:40:33 2016<br>
@@ -2581,30 +2581,10 @@ StringRef BuiltinType::getName(const Pri<br>
return "Class";<br>
case ObjCSel:<br>
return "SEL";<br>
- case OCLImage1d:<br>
- return "image1d_t";<br>
- case OCLImage1dArray:<br>
- return "image1d_array_t";<br>
- case OCLImage1dBuffer:<br>
- return "image1d_buffer_t";<br>
- case OCLImage2d:<br>
- return "image2d_t";<br>
- case OCLImage2dArray:<br>
- return "image2d_array_t";<br>
- case OCLImage2dDepth:<br>
- return "image2d_depth_t";<br>
- case OCLImage2dArrayDepth:<br>
- return "image2d_array_depth_t";<br>
- case OCLImage2dMSAA:<br>
- return "image2d_msaa_t";<br>
- case OCLImage2dArrayMSAA:<br>
- return "image2d_array_msaa_t";<br>
- case OCLImage2dMSAADepth:<br>
- return "image2d_msaa_depth_t";<br>
- case OCLImage2dArrayMSAADepth:<br>
- return "image2d_array_msaa_depth_t";<br>
- case OCLImage3d:<br>
- return "image3d_t";<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case Id: \<br>
+ return "__" #Access " " #ImgType "_t";<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case OCLSampler:<br>
return "sampler_t";<br>
case OCLEvent:<br>
@@ -3578,18 +3558,9 @@ bool Type::canHaveNullability() const {<br>
case BuiltinType::ObjCId:<br>
case BuiltinType::ObjCClass:<br>
case BuiltinType::ObjCSel:<br>
- case BuiltinType::OCLImage1d:<br>
- case BuiltinType::OCLImage1dArray:<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- case BuiltinType::OCLImage2d:<br>
- case BuiltinType::OCLImage2dArray:<br>
- case BuiltinType::OCLImage2dDepth:<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- case BuiltinType::OCLImage3d:<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
case BuiltinType::OCLEvent:<br>
case BuiltinType::OCLClkEvent:<br>
<br>
Modified: cfe/trunk/lib/AST/TypeLoc.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypeLoc.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypeLoc.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/TypeLoc.cpp (original)<br>
+++ cfe/trunk/lib/AST/TypeLoc.cpp Fri Apr 8 08:40:33 2016<br>
@@ -333,18 +333,9 @@ TypeSpecifierType BuiltinTypeLoc::getWri<br>
case BuiltinType::ObjCId:<br>
case BuiltinType::ObjCClass:<br>
case BuiltinType::ObjCSel:<br>
- case BuiltinType::OCLImage1d:<br>
- case BuiltinType::OCLImage1dArray:<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- case BuiltinType::OCLImage2d:<br>
- case BuiltinType::OCLImage2dArray:<br>
- case BuiltinType::OCLImage2dDepth:<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- case BuiltinType::OCLImage3d:<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
case BuiltinType::OCLEvent:<br>
case BuiltinType::OCLClkEvent:<br>
<br>
Modified: cfe/trunk/lib/Analysis/PrintfFormatString.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PrintfFormatString.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PrintfFormatString.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)<br>
+++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Fri Apr 8 08:40:33 2016<br>
@@ -619,6 +619,9 @@ bool PrintfSpecifier::fixType(QualType Q<br>
// Various types which are non-trivial to correct.<br>
return false;<br>
<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
#define SIGNED_TYPE(Id, SingletonId)<br>
#define UNSIGNED_TYPE(Id, SingletonId)<br>
#define FLOATING_TYPE(Id, SingletonId)<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Apr 8 08:40:33 2016<br>
@@ -463,39 +463,11 @@ llvm::DIType *CGDebugInfo::CreateType(co<br>
return SelTy;<br>
}<br>
<br>
- case BuiltinType::OCLImage1d:<br>
- return getOrCreateStructPtrType("opencl_image1d_t", OCLImage1dDITy);<br>
- case BuiltinType::OCLImage1dArray:<br>
- return getOrCreateStructPtrType("opencl_image1d_array_t",<br>
- OCLImage1dArrayDITy);<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- return getOrCreateStructPtrType("opencl_image1d_buffer_t",<br>
- OCLImage1dBufferDITy);<br>
- case BuiltinType::OCLImage2d:<br>
- return getOrCreateStructPtrType("opencl_image2d_t", OCLImage2dDITy);<br>
- case BuiltinType::OCLImage2dArray:<br>
- return getOrCreateStructPtrType("opencl_image2d_array_t",<br>
- OCLImage2dArrayDITy);<br>
- case BuiltinType::OCLImage2dDepth:<br>
- return getOrCreateStructPtrType("opencl_image2d_depth_t",<br>
- OCLImage2dDepthDITy);<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- return getOrCreateStructPtrType("opencl_image2d_array_depth_t",<br>
- OCLImage2dArrayDepthDITy);<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- return getOrCreateStructPtrType("opencl_image2d_msaa_t",<br>
- OCLImage2dMSAADITy);<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- return getOrCreateStructPtrType("opencl_image2d_array_msaa_t",<br>
- OCLImage2dArrayMSAADITy);<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- return getOrCreateStructPtrType("opencl_image2d_msaa_depth_t",<br>
- OCLImage2dMSAADepthDITy);<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- return getOrCreateStructPtrType("opencl_image2d_array_msaa_depth_t",<br>
- OCLImage2dArrayMSAADepthDITy);<br>
- case BuiltinType::OCLImage3d:<br>
- return getOrCreateStructPtrType("opencl_image3d_t", OCLImage3dDITy);<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id: \<br>
+ return getOrCreateStructPtrType("opencl_" #ImgType "_" #Suffix "_t", \<br>
+ SingletonId);<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
return DBuilder.createBasicType(<br>
"opencl_sampler_t", CGM.getContext().getTypeSize(BT),<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Fri Apr 8 08:40:33 2016<br>
@@ -64,18 +64,9 @@ class CGDebugInfo {<br>
llvm::DIType *ClassTy = nullptr;<br>
llvm::DICompositeType *ObjTy = nullptr;<br>
llvm::DIType *SelTy = nullptr;<br>
- llvm::DIType *OCLImage1dDITy = nullptr;<br>
- llvm::DIType *OCLImage1dArrayDITy = nullptr;<br>
- llvm::DIType *OCLImage1dBufferDITy = nullptr;<br>
- llvm::DIType *OCLImage2dDITy = nullptr;<br>
- llvm::DIType *OCLImage2dArrayDITy = nullptr;<br>
- llvm::DIType *OCLImage2dDepthDITy = nullptr;<br>
- llvm::DIType *OCLImage2dArrayDepthDITy = nullptr;<br>
- llvm::DIType *OCLImage2dMSAADITy = nullptr;<br>
- llvm::DIType *OCLImage2dArrayMSAADITy = nullptr;<br>
- llvm::DIType *OCLImage2dMSAADepthDITy = nullptr;<br>
- llvm::DIType *OCLImage2dArrayMSAADepthDITy = nullptr;<br>
- llvm::DIType *OCLImage3dDITy = nullptr;<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ llvm::DIType *SingletonId = nullptr;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
llvm::DIType *OCLEventDITy = nullptr;<br>
llvm::DIType *OCLClkEventDITy = nullptr;<br>
llvm::DIType *OCLQueueDITy = nullptr;<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGOpenCLRuntime.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenCLRuntime.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenCLRuntime.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGOpenCLRuntime.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGOpenCLRuntime.cpp Fri Apr 8 08:40:33 2016<br>
@@ -40,46 +40,12 @@ llvm::Type *CGOpenCLRuntime::convertOpen<br>
default:<br>
llvm_unreachable("Unexpected opencl builtin type!");<br>
return nullptr;<br>
- case BuiltinType::OCLImage1d:<br>
- return llvm::PointerType::get(llvm::StructType::create(<br>
- Ctx, "opencl.image1d_t"), ImgAddrSpc);<br>
- case BuiltinType::OCLImage1dArray:<br>
- return llvm::PointerType::get(llvm::StructType::create(<br>
- Ctx, "opencl.image1d_array_t"), ImgAddrSpc);<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- return llvm::PointerType::get(llvm::StructType::create(<br>
- Ctx, "opencl.image1d_buffer_t"), ImgAddrSpc);<br>
- case BuiltinType::OCLImage2d:<br>
- return llvm::PointerType::get(llvm::StructType::create(<br>
- Ctx, "opencl.image2d_t"), ImgAddrSpc);<br>
- case BuiltinType::OCLImage2dArray:<br>
- return llvm::PointerType::get(llvm::StructType::create(<br>
- Ctx, "opencl.image2d_array_t"), ImgAddrSpc);<br>
- case BuiltinType::OCLImage2dDepth:<br>
- return llvm::PointerType::get(<br>
- llvm::StructType::create(Ctx, "opencl.image2d_depth_t"), ImgAddrSpc);<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- return llvm::PointerType::get(<br>
- llvm::StructType::create(Ctx, "opencl.image2d_array_depth_t"),<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id: \<br>
+ return llvm::PointerType::get( \<br>
+ llvm::StructType::create(Ctx, "opencl." #ImgType "_" #Suffix "_t"), \<br>
ImgAddrSpc);<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- return llvm::PointerType::get(<br>
- llvm::StructType::create(Ctx, "opencl.image2d_msaa_t"), ImgAddrSpc);<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- return llvm::PointerType::get(<br>
- llvm::StructType::create(Ctx, "opencl.image2d_array_msaa_t"),<br>
- ImgAddrSpc);<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- return llvm::PointerType::get(<br>
- llvm::StructType::create(Ctx, "opencl.image2d_msaa_depth_t"),<br>
- ImgAddrSpc);<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- return llvm::PointerType::get(<br>
- llvm::StructType::create(Ctx, "opencl.image2d_array_msaa_depth_t"),<br>
- ImgAddrSpc);<br>
- case BuiltinType::OCLImage3d:<br>
- return llvm::PointerType::get(llvm::StructType::create(<br>
- Ctx, "opencl.image3d_t"), ImgAddrSpc);<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
return llvm::IntegerType::get(Ctx, 32);<br>
case BuiltinType::OCLEvent:<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Fri Apr 8 08:40:33 2016<br>
@@ -464,18 +464,9 @@ llvm::Type *CodeGenTypes::ConvertType(Qu<br>
ResultType = llvm::IntegerType::get(getLLVMContext(), 128);<br>
break;<br>
<br>
- case BuiltinType::OCLImage1d:<br>
- case BuiltinType::OCLImage1dArray:<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- case BuiltinType::OCLImage2d:<br>
- case BuiltinType::OCLImage2dArray:<br>
- case BuiltinType::OCLImage2dDepth:<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- case BuiltinType::OCLImage3d:<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
case BuiltinType::OCLEvent:<br>
case BuiltinType::OCLClkEvent:<br>
<br>
Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Fri Apr 8 08:40:33 2016<br>
@@ -2536,18 +2536,9 @@ static bool TypeInfoIsInStandardLibrary(<br>
case BuiltinType::UInt128:<br>
return true;<br>
<br>
- case BuiltinType::OCLImage1d:<br>
- case BuiltinType::OCLImage1dArray:<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- case BuiltinType::OCLImage2d:<br>
- case BuiltinType::OCLImage2dArray:<br>
- case BuiltinType::OCLImage2dDepth:<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- case BuiltinType::OCLImage3d:<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
case BuiltinType::OCLEvent:<br>
case BuiltinType::OCLClkEvent:<br>
<br>
Modified: cfe/trunk/lib/Index/USRGeneration.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/USRGeneration.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/USRGeneration.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Index/USRGeneration.cpp (original)<br>
+++ cfe/trunk/lib/Index/USRGeneration.cpp Fri Apr 8 08:40:33 2016<br>
@@ -624,18 +624,9 @@ void USRGenerator::VisitType(QualType T)<br>
#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:<br>
#include "clang/AST/BuiltinTypes.def"<br>
case BuiltinType::Dependent:<br>
- case BuiltinType::OCLImage1d:<br>
- case BuiltinType::OCLImage1dArray:<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- case BuiltinType::OCLImage2d:<br>
- case BuiltinType::OCLImage2dArray:<br>
- case BuiltinType::OCLImage2dDepth:<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- case BuiltinType::OCLImage3d:<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLEvent:<br>
case BuiltinType::OCLClkEvent:<br>
case BuiltinType::OCLQueue:<br>
<br>
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)<br>
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Fri Apr 8 08:40:33 2016<br>
@@ -3363,6 +3363,12 @@ void Parser::ParseDeclarationSpecifiers(<br>
}<br>
isInvalid = DS.SetTypePipe(true, Loc, PrevSpec, DiagID, Policy);<br>
break;<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) \<br>
+ case tok::kw_##ImgType##_t: \<br>
+ isInvalid = DS.SetTypeSpecType(DeclSpec::TST_##ImgType##_t, Loc, PrevSpec, \<br>
+ DiagID, Policy); \<br>
+ break;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case tok::kw___unknown_anytype:<br>
isInvalid = DS.SetTypeSpecType(TST_unknown_anytype, Loc,<br>
PrevSpec, DiagID, Policy);<br>
@@ -4300,6 +4306,8 @@ bool Parser::isKnownToBeTypeSpecifier(co<br>
case tok::kw__Decimal64:<br>
case tok::kw__Decimal128:<br>
case tok::kw___vector:<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
<br>
// struct-or-union-specifier (C99) or class-specifier (C++)<br>
case tok::kw_class:<br>
@@ -4372,6 +4380,8 @@ bool Parser::isTypeSpecifierQualifier()<br>
case tok::kw__Decimal64:<br>
case tok::kw__Decimal128:<br>
case tok::kw___vector:<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
<br>
// struct-or-union-specifier (C99) or class-specifier (C++)<br>
case tok::kw_class:<br>
@@ -4608,6 +4618,8 @@ bool Parser::isDeclarationSpecifier(bool<br>
case tok::kw___read_only:<br>
case tok::kw___read_write:<br>
case tok::kw___write_only:<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
<br>
return true;<br>
}<br>
<br>
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)<br>
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Fri Apr 8 08:40:33 2016<br>
@@ -1169,7 +1169,10 @@ ExprResult Parser::ParseCastExpression(b<br>
case tok::kw_void:<br>
case tok::kw_typename:<br>
case tok::kw_typeof:<br>
- case tok::kw___vector: {<br>
+ case tok::kw___vector:<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
+ {<br>
if (!getLangOpts().CPlusPlus) {<br>
Diag(Tok, diag::err_expected_expression);<br>
return ExprError();<br>
<br>
Modified: cfe/trunk/lib/Parse/ParseTentative.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)<br>
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Fri Apr 8 08:40:33 2016<br>
@@ -987,6 +987,8 @@ Parser::isExpressionOrTypeSpecifierSimpl<br>
case tok::kw___pixel:<br>
case tok::kw___bool:<br>
case tok::kw__Atomic:<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case tok::kw___unknown_anytype:<br>
return TPResult::False;<br>
<br>
<br>
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)<br>
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Fri Apr 8 08:40:33 2016<br>
@@ -302,6 +302,8 @@ bool Declarator::isDeclarationOfFunction<br>
case TST_unspecified:<br>
case TST_void:<br>
case TST_wchar:<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
return false;<br>
<br>
case TST_decltype_auto:<br>
@@ -474,6 +476,10 @@ const char *DeclSpec::getSpecifierName(D<br>
case DeclSpec::TST_underlyingType: return "__underlying_type";<br>
case DeclSpec::TST_unknown_anytype: return "__unknown_anytype";<br>
case DeclSpec::TST_atomic: return "_Atomic";<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) \<br>
+ case DeclSpec::TST_##ImgType##_t: \<br>
+ return #ImgType "_t";<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case DeclSpec::TST_error: return "(error)";<br>
}<br>
llvm_unreachable("Unknown typespec!");<br>
<br>
Modified: cfe/trunk/lib/Sema/Sema.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/Sema.cpp (original)<br>
+++ cfe/trunk/lib/Sema/Sema.cpp Fri Apr 8 08:40:33 2016<br>
@@ -208,23 +208,9 @@ void Sema::Initialize() {<br>
<br>
// Initialize predefined OpenCL types.<br>
if (getLangOpts().OpenCL) {<br>
- addImplicitTypedef("image1d_t", Context.OCLImage1dTy);<br>
- addImplicitTypedef("image1d_array_t", Context.OCLImage1dArrayTy);<br>
- addImplicitTypedef("image1d_buffer_t", Context.OCLImage1dBufferTy);<br>
- addImplicitTypedef("image2d_t", Context.OCLImage2dTy);<br>
- addImplicitTypedef("image2d_array_t", Context.OCLImage2dArrayTy);<br>
- addImplicitTypedef("image3d_t", Context.OCLImage3dTy);<br>
addImplicitTypedef("sampler_t", Context.OCLSamplerTy);<br>
addImplicitTypedef("event_t", Context.OCLEventTy);<br>
if (getLangOpts().OpenCLVersion >= 200) {<br>
- addImplicitTypedef("image2d_depth_t", Context.OCLImage2dDepthTy);<br>
- addImplicitTypedef("image2d_array_depth_t",<br>
- Context.OCLImage2dArrayDepthTy);<br>
- addImplicitTypedef("image2d_msaa_t", Context.OCLImage2dMSAATy);<br>
- addImplicitTypedef("image2d_array_msaa_t", Context.OCLImage2dArrayMSAATy);<br>
- addImplicitTypedef("image2d_msaa_depth_t", Context.OCLImage2dMSAADepthTy);<br>
- addImplicitTypedef("image2d_array_msaa_depth_t",<br>
- Context.OCLImage2dArrayMSAADepthTy);<br>
addImplicitTypedef("clk_event_t", Context.OCLClkEventTy);<br>
addImplicitTypedef("queue_t", Context.OCLQueueTy);<br>
addImplicitTypedef("ndrange_t", Context.OCLNDRangeTy);<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Apr 8 08:40:33 2016<br>
@@ -4915,6 +4915,9 @@ static bool isPlaceholderToRemoveAsArg(Q<br>
<br>
switch (placeholder->getKind()) {<br>
// Ignore all the non-placeholder types.<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
#define PLACEHOLDER_TYPE(ID, SINGLETON_ID)<br>
#define BUILTIN_TYPE(ID, SINGLETON_ID) case BuiltinType::ID:<br>
#include "clang/AST/BuiltinTypes.def"<br>
@@ -14840,8 +14843,10 @@ ExprResult Sema::CheckPlaceholderExpr(Ex<br>
return ExprError();<br>
<br>
// Everything else should be impossible.<br>
-#define BUILTIN_TYPE(Id, SingletonId) \<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
+#define BUILTIN_TYPE(Id, SingletonId) case BuiltinType::Id:<br>
#define PLACEHOLDER_TYPE(Id, SingletonId)<br>
#include "clang/AST/BuiltinTypes.def"<br>
break;<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp Fri Apr 8 08:40:33 2016<br>
@@ -739,6 +739,8 @@ bool Sema::containsUnexpandedParameterPa<br>
case TST_auto:<br>
case TST_auto_type:<br>
case TST_decltype_auto:<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case TST_unknown_anytype:<br>
case TST_error:<br>
break;<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaType.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaType.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Apr 8 08:40:33 2016<br>
@@ -11,7 +11,6 @@<br>
//<br>
//===----------------------------------------------------------------------===//<br>
<br>
-#include "clang/Sema/SemaInternal.h"<br>
#include "TypeLocBuilder.h"<br>
#include "clang/AST/ASTConsumer.h"<br>
#include "clang/AST/ASTContext.h"<br>
@@ -22,17 +21,19 @@<br>
#include "clang/AST/Expr.h"<br>
#include "clang/AST/TypeLoc.h"<br>
#include "clang/AST/TypeLocVisitor.h"<br>
-#include "clang/Lex/Preprocessor.h"<br>
#include "clang/Basic/PartialDiagnostic.h"<br>
#include "clang/Basic/TargetInfo.h"<br>
#include "clang/Lex/Preprocessor.h"<br>
+#include "clang/Lex/Preprocessor.h"<br>
#include "clang/Sema/DeclSpec.h"<br>
#include "clang/Sema/DelayedDiagnostic.h"<br>
#include "clang/Sema/Lookup.h"<br>
#include "clang/Sema/ScopeInfo.h"<br>
+#include "clang/Sema/SemaInternal.h"<br>
#include "clang/Sema/Template.h"<br>
#include "llvm/ADT/SmallPtrSet.h"<br>
#include "llvm/ADT/SmallString.h"<br>
+#include "llvm/ADT/StringSwitch.h"<br>
#include "llvm/Support/ErrorHandling.h"<br>
<br>
using namespace clang;<br>
@@ -1178,6 +1179,21 @@ TypeResult Sema::actOnObjCTypeArgsAndPro<br>
return CreateParsedType(Result, ResultTInfo);<br>
}<br>
<br>
+static StringRef getImageAccessAttrStr(AttributeList *attrs) {<br>
+ if (attrs) {<br>
+<br>
+ AttributeList *Next;<br>
+ do {<br>
+ AttributeList &Attr = *attrs;<br>
+ Next = Attr.getNext();<br>
+ if (Attr.getKind() == AttributeList::AT_OpenCLAccess) {<br>
+ return Attr.getName()->getName();<br>
+ }<br>
+ } while (Next);<br>
+ }<br>
+ return "";<br>
+}<br>
+<br>
/// \brief Convert the specified declspec to the appropriate type<br>
/// object.<br>
/// \param state Specifies the declarator containing the declaration specifier<br>
@@ -1362,6 +1378,7 @@ static QualType ConvertDeclSpecToType(Ty<br>
}<br>
break;<br>
case DeclSpec::TST_bool: Result = Context.BoolTy; break; // _Bool or bool<br>
+ break;<br>
case DeclSpec::TST_decimal32: // _Decimal32<br>
case DeclSpec::TST_decimal64: // _Decimal64<br>
case DeclSpec::TST_decimal128: // _Decimal128<br>
@@ -1430,9 +1447,18 @@ static QualType ConvertDeclSpecToType(Ty<br>
declarator.setInvalidType(true);<br>
}<br>
} else if (!S.getOpenCLOptions().cl_khr_gl_msaa_sharing &&<br>
- (Result->isImage2dMSAAT() || Result->isImage2dArrayMSAAT() ||<br>
- Result->isImage2dArrayMSAATDepth() ||<br>
- Result->isImage2dMSAATDepth())) {<br>
+ (Result->isOCLImage2dArrayMSAADepthROType() ||<br>
+ Result->isOCLImage2dArrayMSAADepthWOType() ||<br>
+ Result->isOCLImage2dArrayMSAADepthRWType() ||<br>
+ Result->isOCLImage2dArrayMSAAROType() ||<br>
+ Result->isOCLImage2dArrayMSAARWType() ||<br>
+ Result->isOCLImage2dArrayMSAAWOType() ||<br>
+ Result->isOCLImage2dMSAADepthROType() ||<br>
+ Result->isOCLImage2dMSAADepthRWType() ||<br>
+ Result->isOCLImage2dMSAADepthWOType() ||<br>
+ Result->isOCLImage2dMSAAROType() ||<br>
+ Result->isOCLImage2dMSAARWType() ||<br>
+ Result->isOCLImage2dMSAAWOType())) {<br>
S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_requires_extension)<br>
<< Result << "cl_khr_gl_msaa_sharing";<br>
declarator.setInvalidType(true);<br>
@@ -1546,6 +1572,16 @@ static QualType ConvertDeclSpecToType(Ty<br>
}<br>
break;<br>
<br>
+#define GENERIC_IMAGE_TYPE(ImgType, Id) \<br>
+ case DeclSpec::TST_##ImgType##_t: \<br>
+ Result = llvm::StringSwitch<QualType>( \<br>
+ getImageAccessAttrStr(DS.getAttributes().getList())) \<br>
+ .Cases("write_only", "__write_only", Context.Id##WOTy) \<br>
+ .Cases("read_write", "__read_write", Context.Id##RWTy) \<br>
+ .Default(Context.Id##ROTy); \<br>
+ break;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
+<br>
case DeclSpec::TST_error:<br>
Result = Context.IntTy;<br>
declarator.setInvalidType(true);<br>
<br>
Modified: cfe/trunk/lib/Serialization/ASTCommon.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTCommon.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTCommon.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Serialization/ASTCommon.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/ASTCommon.cpp Fri Apr 8 08:40:33 2016<br>
@@ -127,42 +127,11 @@ serialization::TypeIdxFromBuiltin(const<br>
case BuiltinType::ObjCSel:<br>
ID = PREDEF_TYPE_OBJC_SEL;<br>
break;<br>
- case BuiltinType::OCLImage1d:<br>
- ID = PREDEF_TYPE_IMAGE1D_ID;<br>
- break;<br>
- case BuiltinType::OCLImage1dArray:<br>
- ID = PREDEF_TYPE_IMAGE1D_ARR_ID;<br>
- break;<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- ID = PREDEF_TYPE_IMAGE1D_BUFF_ID;<br>
- break;<br>
- case BuiltinType::OCLImage2d:<br>
- ID = PREDEF_TYPE_IMAGE2D_ID;<br>
- break;<br>
- case BuiltinType::OCLImage2dArray:<br>
- ID = PREDEF_TYPE_IMAGE2D_ARR_ID;<br>
- break;<br>
- case BuiltinType::OCLImage2dDepth:<br>
- ID = PREDEF_TYPE_IMAGE2D_DEP_ID;<br>
- break;<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- ID = PREDEF_TYPE_IMAGE2D_ARR_DEP_ID;<br>
- break;<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- ID = PREDEF_TYPE_IMAGE2D_MSAA_ID;<br>
- break;<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- ID = PREDEF_TYPE_IMAGE2D_ARR_MSAA_ID;<br>
- break;<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- ID = PREDEF_TYPE_IMAGE2D_MSAA_DEP_ID;<br>
- break;<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- ID = PREDEF_TYPE_IMAGE2D_ARR_MSAA_DEPTH_ID;<br>
- break;<br>
- case BuiltinType::OCLImage3d:<br>
- ID = PREDEF_TYPE_IMAGE3D_ID;<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id: \<br>
+ ID = PREDEF_TYPE_##Id##_ID; \<br>
break;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
ID = PREDEF_TYPE_SAMPLER_ID;<br>
break;<br>
<br>
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Apr 8 08:40:33 2016<br>
@@ -6092,42 +6092,11 @@ QualType ASTReader::GetType(TypeID ID) {<br>
case PREDEF_TYPE_OBJC_SEL:<br>
T = Context.ObjCBuiltinSelTy;<br>
break;<br>
- case PREDEF_TYPE_IMAGE1D_ID:<br>
- T = Context.OCLImage1dTy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE1D_ARR_ID:<br>
- T = Context.OCLImage1dArrayTy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE1D_BUFF_ID:<br>
- T = Context.OCLImage1dBufferTy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE2D_ID:<br>
- T = Context.OCLImage2dTy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE2D_ARR_ID:<br>
- T = Context.OCLImage2dArrayTy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE2D_DEP_ID:<br>
- T = Context.OCLImage2dDepthTy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE2D_ARR_DEP_ID:<br>
- T = Context.OCLImage2dArrayDepthTy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE2D_MSAA_ID:<br>
- T = Context.OCLImage2dMSAATy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE2D_ARR_MSAA_ID:<br>
- T = Context.OCLImage2dArrayMSAATy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE2D_MSAA_DEP_ID:<br>
- T = Context.OCLImage2dMSAADepthTy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE2D_ARR_MSAA_DEPTH_ID:<br>
- T = Context.OCLImage2dArrayMSAADepthTy;<br>
- break;<br>
- case PREDEF_TYPE_IMAGE3D_ID:<br>
- T = Context.OCLImage3dTy;<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case PREDEF_TYPE_##Id##_ID: \<br>
+ T = Context.SingletonId; \<br>
break;<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case PREDEF_TYPE_SAMPLER_ID:<br>
T = Context.OCLSamplerTy;<br>
break;<br>
<br>
Added: cfe/trunk/test/CodeGenOpenCL/<a href="http://images.cl" rel="noreferrer" target="_blank">images.cl</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/images.cl?rev=265783&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/images.cl?rev=265783&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenOpenCL/<a href="http://images.cl" rel="noreferrer" target="_blank">images.cl</a> (added)<br>
+++ cfe/trunk/test/CodeGenOpenCL/<a href="http://images.cl" rel="noreferrer" target="_blank">images.cl</a> Fri Apr 8 08:40:33 2016<br>
@@ -0,0 +1,11 @@<br>
+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -emit-llvm -o - | FileCheck %s<br>
+<br>
+__attribute__((overloadable)) void read_image(read_only image1d_t img_ro);<br>
+__attribute__((overloadable)) void read_image(write_only image1d_t img_wo);<br>
+<br>
+kernel void test_read_image(read_only image1d_t img_ro, write_only image1d_t img_wo) {<br>
+ // CHECK: call void @_Z10read_image14ocl_image1d_ro(%opencl.image1d_ro_t* %{{[0-9]+}})<br>
+ read_image(img_ro);<br>
+ // CHECK: call void @_Z10read_image14ocl_image1d_wo(%opencl.image1d_wo_t* %{{[0-9]+}})<br>
+ read_image(img_wo);<br>
+}<br>
<br>
Modified: cfe/trunk/test/CodeGenOpenCL/<a href="http://opencl_types.cl" rel="noreferrer" target="_blank">opencl_types.cl</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/opencl_types.cl?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/opencl_types.cl?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenOpenCL/<a href="http://opencl_types.cl" rel="noreferrer" target="_blank">opencl_types.cl</a> (original)<br>
+++ cfe/trunk/test/CodeGenOpenCL/<a href="http://opencl_types.cl" rel="noreferrer" target="_blank">opencl_types.cl</a> Fri Apr 8 08:40:33 2016<br>
@@ -4,37 +4,37 @@ constant sampler_t glb_smp = 7;<br>
// CHECK: constant i32 7<br>
<br>
void fnc1(image1d_t img) {}<br>
-// CHECK: @fnc1(%opencl.image1d_t*<br>
+// CHECK: @fnc1(%opencl.image1d_ro_t*<br>
<br>
void fnc1arr(image1d_array_t img) {}<br>
-// CHECK: @fnc1arr(%opencl.image1d_array_t*<br>
+// CHECK: @fnc1arr(%opencl.image1d_array_ro_t*<br>
<br>
void fnc1buff(image1d_buffer_t img) {}<br>
-// CHECK: @fnc1buff(%opencl.image1d_buffer_t*<br>
+// CHECK: @fnc1buff(%opencl.image1d_buffer_ro_t*<br>
<br>
void fnc2(image2d_t img) {}<br>
-// CHECK: @fnc2(%opencl.image2d_t*<br>
+// CHECK: @fnc2(%opencl.image2d_ro_t*<br>
<br>
void fnc2arr(image2d_array_t img) {}<br>
-// CHECK: @fnc2arr(%opencl.image2d_array_t*<br>
+// CHECK: @fnc2arr(%opencl.image2d_array_ro_t*<br>
<br>
void fnc3(image3d_t img) {}<br>
-// CHECK: @fnc3(%opencl.image3d_t*<br>
+// CHECK: @fnc3(%opencl.image3d_ro_t*<br>
<br>
void fnc4smp(sampler_t s) {}<br>
// CHECK-LABEL: define {{.*}}void @fnc4smp(i32<br>
<br>
kernel void foo(image1d_t img) {<br>
- sampler_t smp = 5;<br>
-// CHECK: alloca i32<br>
- event_t evt;<br>
-// CHECK: alloca %opencl.event_t*<br>
-// CHECK: store i32 5,<br>
+ sampler_t smp = 5;<br>
+ // CHECK: alloca i32<br>
+ event_t evt;<br>
+ // CHECK: alloca %opencl.event_t*<br>
+ // CHECK: store i32 5,<br>
fnc4smp(smp);<br>
-// CHECK: call {{.*}}void @fnc4smp(i32<br>
+ // CHECK: call {{.*}}void @fnc4smp(i32<br>
fnc4smp(glb_smp);<br>
-// CHECK: call {{.*}}void @fnc4smp(i32<br>
+ // CHECK: call {{.*}}void @fnc4smp(i32<br>
}<br>
<br>
void __attribute__((overloadable)) bad1(image1d_t b, image2d_t c, image2d_t d) {}<br>
-// CHECK-LABEL: @{{_Z4bad111ocl_image1d11ocl_image2dS0_|"\\01\?bad1@@\$\$J0YAXPAUocl_image1d@@PAUocl_image2d@@1@Z"}}<br>
+// CHECK-LABEL: @{{_Z4bad114ocl_image1d_ro14ocl_image2d_roS0_|"\\01\?bad1@@\$\$J0YAXPAUocl_image1d_ro@@PAUocl_image2d_ro@@1@Z"}}<br>
<br>
Added: cfe/trunk/test/SemaOpenCL/<a href="http://images.cl" rel="noreferrer" target="_blank">images.cl</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/images.cl?rev=265783&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/images.cl?rev=265783&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/SemaOpenCL/<a href="http://images.cl" rel="noreferrer" target="_blank">images.cl</a> (added)<br>
+++ cfe/trunk/test/SemaOpenCL/<a href="http://images.cl" rel="noreferrer" target="_blank">images.cl</a> Fri Apr 8 08:40:33 2016<br>
@@ -0,0 +1,9 @@<br>
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only<br>
+<br>
+void img2d_ro(__read_only image2d_t img) {} // expected-note{{passing argument to parameter 'img' here}} expected-note{{passing argument to parameter 'img' here}}<br>
+<br>
+void imgage_access_test(image2d_t img2dro, write_only image2d_t img2dwo, image3d_t img3dro) {<br>
+ img2d_ro(img2dro);<br>
+ img2d_ro(img2dwo); // expected-error{{passing '__write_only image2d_t' to parameter of incompatible type '__read_only image2d_t'}}<br>
+ img2d_ro(img3dro); // expected-error{{passing '__read_only image3d_t' to parameter of incompatible type '__read_only image2d_t'}}<br>
+}<br>
<br>
Modified: cfe/trunk/test/SemaOpenCL/<a href="http://invalid-access-qualifier.cl" rel="noreferrer" target="_blank">invalid-access-qualifier.cl</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/SemaOpenCL/<a href="http://invalid-access-qualifier.cl" rel="noreferrer" target="_blank">invalid-access-qualifier.cl</a> (original)<br>
+++ cfe/trunk/test/SemaOpenCL/<a href="http://invalid-access-qualifier.cl" rel="noreferrer" target="_blank">invalid-access-qualifier.cl</a> Fri Apr 8 08:40:33 2016<br>
@@ -10,5 +10,5 @@ void test3(read_only read_only image1d_t<br>
#ifdef CL20<br>
void test4(read_write pipe int i){} // expected-error{{access qualifier 'read_write' can not be used for 'pipe'}}<br>
#else<br>
-void test4(__read_write image1d_t i){} // expected-error{{access qualifier '__read_write' can not be used for 'image1d_t' earlier than OpenCL2.0 version}}<br>
+void test4(__read_write image1d_t i) {} // expected-error{{access qualifier '__read_write' can not be used for '__read_write image1d_t' earlier than OpenCL2.0 version}}<br>
#endif<br>
<br>
Modified: cfe/trunk/test/SemaOpenCL/<a href="http://invalid-image.cl" rel="noreferrer" target="_blank">invalid-image.cl</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-image.cl?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-image.cl?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/SemaOpenCL/<a href="http://invalid-image.cl" rel="noreferrer" target="_blank">invalid-image.cl</a> (original)<br>
+++ cfe/trunk/test/SemaOpenCL/<a href="http://invalid-image.cl" rel="noreferrer" target="_blank">invalid-image.cl</a> Fri Apr 8 08:40:33 2016<br>
@@ -1,8 +1,8 @@<br>
// RUN: %clang_cc1 -verify %s<br>
<br>
-void test1(image1d_t *i){} // expected-error {{pointer to type 'image1d_t' is invalid in OpenCL}}<br>
+void test1(image1d_t *i) {} // expected-error {{pointer to type '__read_only image1d_t' is invalid in OpenCL}}<br>
<br>
void test2(image1d_t i) {<br>
- image1d_t ti; // expected-error {{type 'image1d_t' can only be used as a function parameter}}<br>
- image1d_t ai[] = {i,i};// expected-error {{array of 'image1d_t' type is invalid in OpenCL}}<br>
+ image1d_t ti; // expected-error {{type '__read_only image1d_t' can only be used as a function parameter}}<br>
+ image1d_t ai[] = {i, i}; // expected-error {{array of '__read_only image1d_t' type is invalid in OpenCL}}<br>
}<br>
<br>
Modified: cfe/trunk/test/SemaOpenCL/<a href="http://invalid-kernel-parameters.cl" rel="noreferrer" target="_blank">invalid-kernel-parameters.cl</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/SemaOpenCL/<a href="http://invalid-kernel-parameters.cl" rel="noreferrer" target="_blank">invalid-kernel-parameters.cl</a> (original)<br>
+++ cfe/trunk/test/SemaOpenCL/<a href="http://invalid-kernel-parameters.cl" rel="noreferrer" target="_blank">invalid-kernel-parameters.cl</a> Fri Apr 8 08:40:33 2016<br>
@@ -27,7 +27,7 @@ typedef struct FooImage2D // expected-no<br>
// TODO: Clean up needed - we don't really need to check for image, event, etc<br>
// as a note here any longer.<br>
// They are diagnosed as an error for all struct fields (OpenCL v1.2 s6.9b,r).<br>
- image2d_t imageField; // expected-note{{field of illegal type 'image2d_t' declared here}} expected-error{{the 'image2d_t' type cannot be used to declare a structure or union field}}<br>
+ image2d_t imageField; // expected-note{{field of illegal type '__read_only image2d_t' declared here}} expected-error{{the '__read_only image2d_t' type cannot be used to declare a structure or union field}}<br>
} FooImage2D;<br>
<br>
kernel void image_in_struct_arg(FooImage2D arg) { } // expected-error{{struct kernel parameters may not contain pointers}}<br>
<br>
Modified: cfe/trunk/tools/libclang/CIndex.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=265783&r1=265782&r2=265783&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=265783&r1=265782&r2=265783&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/tools/libclang/CIndex.cpp (original)<br>
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Apr 8 08:40:33 2016<br>
@@ -1454,18 +1454,9 @@ bool CursorVisitor::VisitBuiltinTypeLoc(<br>
case BuiltinType::Void:<br>
case BuiltinType::NullPtr:<br>
case BuiltinType::Dependent:<br>
- case BuiltinType::OCLImage1d:<br>
- case BuiltinType::OCLImage1dArray:<br>
- case BuiltinType::OCLImage1dBuffer:<br>
- case BuiltinType::OCLImage2d:<br>
- case BuiltinType::OCLImage2dArray:<br>
- case BuiltinType::OCLImage2dDepth:<br>
- case BuiltinType::OCLImage2dArrayDepth:<br>
- case BuiltinType::OCLImage2dMSAA:<br>
- case BuiltinType::OCLImage2dArrayMSAA:<br>
- case BuiltinType::OCLImage2dMSAADepth:<br>
- case BuiltinType::OCLImage2dArrayMSAADepth:<br>
- case BuiltinType::OCLImage3d:<br>
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \<br>
+ case BuiltinType::Id:<br>
+#include "clang/AST/OpenCLImageTypes.def"<br>
case BuiltinType::OCLSampler:<br>
case BuiltinType::OCLEvent:<br>
case BuiltinType::OCLClkEvent:<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>