aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/ASTContext.h1
-rw-r--r--include/clang/AST/BuiltinTypes.def3
-rw-r--r--include/clang/AST/OperationKinds.h5
-rw-r--r--include/clang/AST/Type.h8
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td8
-rw-r--r--include/clang/Basic/Specifiers.h1
-rw-r--r--include/clang/Basic/TokenKinds.def1
-rw-r--r--include/clang/Sema/DeclSpec.h1
-rw-r--r--include/clang/Sema/Initialization.h8
-rw-r--r--include/clang/Serialization/ASTBitCodes.h3
-rw-r--r--lib/AST/ASTContext.cpp4
-rw-r--r--lib/AST/Expr.cpp3
-rw-r--r--lib/AST/ExprConstant.cpp2
-rw-r--r--lib/AST/ItaniumMangle.cpp1
-rw-r--r--lib/AST/MicrosoftMangle.cpp1
-rw-r--r--lib/AST/NSAPI.cpp1
-rw-r--r--lib/AST/Type.cpp1
-rw-r--r--lib/AST/TypeLoc.cpp1
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp3
-rw-r--r--lib/CodeGen/CGDebugInfo.h1
-rw-r--r--lib/CodeGen/CGExpr.cpp2
-rw-r--r--lib/CodeGen/CGExprAgg.cpp1
-rw-r--r--lib/CodeGen/CGExprComplex.cpp1
-rw-r--r--lib/CodeGen/CGExprConstant.cpp1
-rw-r--r--lib/CodeGen/CGExprScalar.cpp5
-rw-r--r--lib/CodeGen/CGOpenCLRuntime.cpp3
-rw-r--r--lib/CodeGen/CGRTTI.cpp1
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp1
-rw-r--r--lib/Edit/RewriteObjCFoundationAPI.cpp1
-rw-r--r--lib/Parse/ParseDecl.cpp7
-rw-r--r--lib/Parse/ParseExpr.cpp1
-rw-r--r--lib/Parse/ParseTentative.cpp1
-rw-r--r--lib/Sema/DeclSpec.cpp2
-rw-r--r--lib/Sema/SemaDecl.cpp50
-rw-r--r--lib/Sema/SemaInit.cpp49
-rw-r--r--lib/Sema/SemaTemplateVariadic.cpp1
-rw-r--r--lib/Sema/SemaType.cpp4
-rw-r--r--lib/Serialization/ASTCommon.cpp1
-rw-r--r--lib/Serialization/ASTReader.cpp1
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngineC.cpp3
-rw-r--r--test/CodeGenOpenCL/event_t.cl12
-rw-r--r--test/CodeGenOpenCL/opencl_types.cl2
-rw-r--r--test/PCH/ocl_types.cl4
-rw-r--r--test/PCH/ocl_types.h3
-rw-r--r--test/SemaOpenCL/event_t.cl17
-rw-r--r--tools/libclang/CIndex.cpp1
-rw-r--r--tools/libclang/CIndexUSRs.cpp1
47 files changed, 221 insertions, 12 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index fcea6fb292..05f818299b 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -721,6 +721,7 @@ public:
CanQualType OCLImage1dTy, OCLImage1dArrayTy, OCLImage1dBufferTy;
CanQualType OCLImage2dTy, OCLImage2dArrayTy;
CanQualType OCLImage3dTy;
+ CanQualType OCLEventTy;
// Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand.
mutable QualType AutoDeductTy; // Deduction against 'auto'.
diff --git a/include/clang/AST/BuiltinTypes.def b/include/clang/AST/BuiltinTypes.def
index cb7cfedb39..503d963eca 100644
--- a/include/clang/AST/BuiltinTypes.def
+++ b/include/clang/AST/BuiltinTypes.def
@@ -162,6 +162,9 @@ BUILTIN_TYPE(OCLImage2d, OCLImage2dTy)
BUILTIN_TYPE(OCLImage2dArray, OCLImage2dArrayTy)
BUILTIN_TYPE(OCLImage3d, OCLImage3dTy)
+// OpenCL event_t.
+BUILTIN_TYPE(OCLEvent, OCLEventTy)
+
// This represents the type of an expression whose type is
// totally unknown, e.g. 'T::foo'. It is permitted for this to
// appear in situations where the structure of the type is
diff --git a/include/clang/AST/OperationKinds.h b/include/clang/AST/OperationKinds.h
index 18169fd60c..5e41d955cf 100644
--- a/include/clang/AST/OperationKinds.h
+++ b/include/clang/AST/OperationKinds.h
@@ -292,7 +292,10 @@ enum CastKind {
// Convert a builtin function to a function pointer; only allowed in the
// callee of a call expression.
- CK_BuiltinFnToFnPtr
+ CK_BuiltinFnToFnPtr,
+
+ // Convert a zero value for OpenCL event_t initialization.
+ CK_ZeroToOCLEvent
};
static const CastKind CK_Invalid = static_cast<CastKind>(-1);
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index f1db761557..cc6c1fd445 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -1584,6 +1584,8 @@ public:
bool isImageType() const; // Any OpenCL image type
+ bool isEventT() const; // OpenCL event_t
+
bool isOpenCLSpecificType() const; // Any OpenCL specific type
/// Determines if this type, which must satisfy
@@ -4916,6 +4918,10 @@ inline bool Type::isImage2dArrayT() const {
inline bool Type::isImage3dT() const {
return isSpecificBuiltinType(BuiltinType::OCLImage3d);
}
+inline bool Type::isEventT() const {
+ return isSpecificBuiltinType(BuiltinType::OCLEvent);
+}
+
inline bool Type::isImageType() const {
return isImage3dT() ||
isImage2dT() || isImage2dArrayT() ||
@@ -4923,7 +4929,7 @@ inline bool Type::isImageType() const {
}
inline bool Type::isOpenCLSpecificType() const {
- return isImageType();
+ return isImageType() || isEventT();
}
inline bool Type::isTemplateTypeParmType() const {
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index c3f034a53a..3999fadc51 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6081,6 +6081,14 @@ def err_opencl_bitfields : Error<
"bitfields are not supported in OpenCL">;
def err_opencl_vla : Error<
"variable length arrays are not supported in OpenCL">;
+def err_event_t_kernel_arg : Error<
+ "the event_t type cannot be used to declare a kernel function argument">;
+def err_event_t_global_var : Error<
+ "the event_t type cannot be used to declare a program scope variable">;
+def err_event_t_struct_field : Error<
+ "the event_t type cannot be used to declare a structure or union field">;
+def err_event_t_addr_space_qual : Error<
+ "the event_t type can only be used with __private address space qualifier">;
} // end of sema category
diff --git a/include/clang/Basic/Specifiers.h b/include/clang/Basic/Specifiers.h
index 321048f985..533cefeaae 100644
--- a/include/clang/Basic/Specifiers.h
+++ b/include/clang/Basic/Specifiers.h
@@ -68,6 +68,7 @@ namespace clang {
TST_image2d_t, // OpenCL image2d_t
TST_image2d_array_t, // OpenCL image2d_array_t
TST_image3d_t, // OpenCL image3d_t
+ TST_event_t, // OpenCL event_t
TST_error // erroneous type
};
diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def
index b4c0b2d97f..8008ca60a8 100644
--- a/include/clang/Basic/TokenKinds.def
+++ b/include/clang/Basic/TokenKinds.def
@@ -455,6 +455,7 @@ KEYWORD(image1d_buffer_t , KEYOPENCL)
KEYWORD(image2d_t , KEYOPENCL)
KEYWORD(image2d_array_t , KEYOPENCL)
KEYWORD(image3d_t , KEYOPENCL)
+KEYWORD(event_t , KEYOPENCL)
// Borland Extensions.
KEYWORD(__pascal , KEYALL)
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h
index b232d34c40..0d2c948399 100644
--- a/include/clang/Sema/DeclSpec.h
+++ b/include/clang/Sema/DeclSpec.h
@@ -282,6 +282,7 @@ public:
static const TST TST_image2d_t = clang::TST_image2d_t;
static const TST TST_image2d_array_t = clang::TST_image2d_array_t;
static const TST TST_image3d_t = clang::TST_image3d_t;
+ static const TST TST_event_t = clang::TST_event_t;
static const TST TST_error = clang::TST_error;
// type-qualifiers
diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h
index 778b70b0ec..002a12605d 100644
--- a/include/clang/Sema/Initialization.h
+++ b/include/clang/Sema/Initialization.h
@@ -624,7 +624,9 @@ public:
/// \brief Produce an Objective-C object pointer.
SK_ProduceObjCObject,
/// \brief Construct a std::initializer_list from an initializer list.
- SK_StdInitializerList
+ SK_StdInitializerList,
+ /// \brief Passing zero to a function where OpenCL event_t is expected.
+ SK_OCLZeroEvent
};
/// \brief A single step in the initialization sequence.
@@ -953,6 +955,10 @@ public:
/// initializer list.
void AddStdInitializerListConstructionStep(QualType T);
+ /// \brief Add a step to initialize an OpenCL event_t from a NULL
+ /// constant.
+ void AddOCLZeroEventStep(QualType T);
+
/// \brief Add steps to unwrap a initializer list for a reference around a
/// single element and rewrap it at the end.
void RewrapReferenceInitList(QualType T, InitListExpr *Syntactic);
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index a938697263..10453ec841 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -715,7 +715,8 @@ namespace clang {
/// \brief OpenCL 2d image array type.
PREDEF_TYPE_IMAGE2D_ARR_ID = 42,
/// \brief OpenCL 3d image type.
- PREDEF_TYPE_IMAGE3D_ID = 43
+ PREDEF_TYPE_IMAGE3D_ID = 43,
+ PREDEF_TYPE_EVENT_ID = 44
};
/// \brief The number of predefined type IDs that are reserved for
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index ace9dc0146..b18fa679ca 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -893,6 +893,8 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target) {
InitBuiltinType(OCLImage2dTy, BuiltinType::OCLImage2d);
InitBuiltinType(OCLImage2dArrayTy, BuiltinType::OCLImage2dArray);
InitBuiltinType(OCLImage3dTy, BuiltinType::OCLImage3d);
+
+ InitBuiltinType(OCLEventTy, BuiltinType::OCLEvent);
}
// Builtin type for __objc_yes and __objc_no
@@ -1434,6 +1436,7 @@ ASTContext::getTypeInfoImpl(const Type *T) const {
Width = Target->getPointerWidth(0);
Align = Target->getPointerAlign(0);
break;
+ case BuiltinType::OCLEvent:
case BuiltinType::OCLImage1d:
case BuiltinType::OCLImage1dArray:
case BuiltinType::OCLImage1dBuffer:
@@ -4895,6 +4898,7 @@ static char getObjCEncodingForPrimitiveKind(const ASTContext *C,
case BuiltinType::OCLImage2d:
case BuiltinType::OCLImage2dArray:
case BuiltinType::OCLImage3d:
+ case BuiltinType::OCLEvent:
case BuiltinType::Dependent:
#define BUILTIN_TYPE(KIND, ID)
#define PLACEHOLDER_TYPE(KIND, ID) \
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 718002f97d..e3ff29d2d0 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1400,6 +1400,7 @@ void CastExpr::CheckCastConsistency() const {
case CK_ARCConsumeObject:
case CK_ARCReclaimReturnedObject:
case CK_ARCExtendBlockObject:
+ case CK_ZeroToOCLEvent:
assert(!getType()->isBooleanType() && "unheralded conversion to bool");
goto CheckNoBasePath;
@@ -1531,6 +1532,8 @@ const char *CastExpr::getCastKindName() const {
return "CopyAndAutoreleaseBlockObject";
case CK_BuiltinFnToFnPtr:
return "BuiltinFnToFnPtr";
+ case CK_ZeroToOCLEvent:
+ return "ZeroToOCLEvent";
}
llvm_unreachable("Unhandled cast kind!");
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 9965e1288b..64fd40b7a6 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -5372,6 +5372,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
case CK_IntegralComplexCast:
case CK_IntegralComplexToFloatingComplex:
case CK_BuiltinFnToFnPtr:
+ case CK_ZeroToOCLEvent:
llvm_unreachable("invalid cast kind for integral value");
case CK_BitCast:
@@ -5859,6 +5860,7 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
case CK_ARCExtendBlockObject:
case CK_CopyAndAutoreleaseBlockObject:
case CK_BuiltinFnToFnPtr:
+ case CK_ZeroToOCLEvent:
llvm_unreachable("invalid cast kind for complex value");
case CK_LValueToRValue:
diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp
index 65e630eb25..926384decb 100644
--- a/lib/AST/ItaniumMangle.cpp
+++ b/lib/AST/ItaniumMangle.cpp
@@ -1886,6 +1886,7 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
case BuiltinType::OCLImage2d: Out << "11ocl_image2d"; break;
case BuiltinType::OCLImage2dArray: Out << "16ocl_image2darray"; break;
case BuiltinType::OCLImage3d: Out << "11ocl_image3d"; break;
+ case BuiltinType::OCLEvent: Out << "9ocl_event"; break;
}
}
diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp
index bd0125d639..0b77ac8c78 100644
--- a/lib/AST/MicrosoftMangle.cpp
+++ b/lib/AST/MicrosoftMangle.cpp
@@ -1060,6 +1060,7 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T,
case BuiltinType::OCLImage2d: Out << "PAUocl_image2d@@"; break;
case BuiltinType::OCLImage2dArray: Out << "PAUocl_image2darray@@"; break;
case BuiltinType::OCLImage3d: Out << "PAUocl_image3d@@"; break;
+ case BuiltinType::OCLEvent: Out << "PAUocl_event@@"; break;
case BuiltinType::NullPtr: Out << "$$T"; break;
diff --git a/lib/AST/NSAPI.cpp b/lib/AST/NSAPI.cpp
index 35cc7d050b..c8cf920d0c 100644
--- a/lib/AST/NSAPI.cpp
+++ b/lib/AST/NSAPI.cpp
@@ -351,6 +351,7 @@ NSAPI::getNSNumberFactoryMethodKind(QualType T) const {
case BuiltinType::OCLImage2d:
case BuiltinType::OCLImage2dArray:
case BuiltinType::OCLImage3d:
+ case BuiltinType::OCLEvent:
case BuiltinType::BoundMember:
case BuiltinType::Dependent:
case BuiltinType::Overload:
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 45ec4edbc5..524d00560c 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -1518,6 +1518,7 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const {
case OCLImage2d: return "image2d_t";
case OCLImage2dArray: return "image2d_array_t";
case OCLImage3d: return "image3d_t";
+ case OCLEvent: return "event_t";
}
llvm_unreachable("Invalid builtin type.");
diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp
index a5baf703a4..3efa1485ab 100644
--- a/lib/AST/TypeLoc.cpp
+++ b/lib/AST/TypeLoc.cpp
@@ -268,6 +268,7 @@ TypeSpecifierType BuiltinTypeLoc::getWrittenTypeSpec() const {
case BuiltinType::OCLImage2d:
case BuiltinType::OCLImage2dArray:
case BuiltinType::OCLImage3d:
+ case BuiltinType::OCLEvent:
case BuiltinType::BuiltinFn:
return TST_unspecified;
}
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 37df4b33ce..264d075e5c 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -426,6 +426,9 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) {
case BuiltinType::OCLImage3d:
return getOrCreateStructPtrType("opencl_image3d_t",
OCLImage3dDITy);
+ case BuiltinType::OCLEvent:
+ return getOrCreateStructPtrType("opencl_event_t",
+ OCLEventDITy);
case BuiltinType::UChar:
case BuiltinType::Char_U: Encoding = llvm::dwarf::DW_ATE_unsigned_char; break;
diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h
index 3ecf2edfb0..fbbee0b3d2 100644
--- a/lib/CodeGen/CGDebugInfo.h
+++ b/lib/CodeGen/CGDebugInfo.h
@@ -55,6 +55,7 @@ class CGDebugInfo {
llvm::DIType OCLImage1dDITy, OCLImage1dArrayDITy, OCLImage1dBufferDITy;
llvm::DIType OCLImage2dDITy, OCLImage2dArrayDITy;
llvm::DIType OCLImage3dDITy;
+ llvm::DIType OCLEventDITy;
/// TypeCache - Cache of previously constructed Types.
llvm::DenseMap<void *, llvm::WeakVH> TypeCache;
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index cdbd6e7bb7..9bef08b4a5 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -2639,6 +2639,8 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
ConvertType(ToType));
return MakeAddrLValue(V, E->getType());
}
+ case CK_ZeroToOCLEvent:
+ llvm_unreachable("NULL to OpenCL event lvalue cast is not valid");
}
llvm_unreachable("Unhandled lvalue cast kind?");
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index b037113945..a35ef0c931 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -648,6 +648,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
case CK_ARCExtendBlockObject:
case CK_CopyAndAutoreleaseBlockObject:
case CK_BuiltinFnToFnPtr:
+ case CK_ZeroToOCLEvent:
llvm_unreachable("cast kind invalid for aggregate types");
}
}
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp
index 127029795c..0a53d4f127 100644
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/lib/CodeGen/CGExprComplex.cpp
@@ -428,6 +428,7 @@ ComplexPairTy ComplexExprEmitter::EmitCast(CastExpr::CastKind CK, Expr *Op,
case CK_ARCExtendBlockObject:
case CK_CopyAndAutoreleaseBlockObject:
case CK_BuiltinFnToFnPtr:
+ case CK_ZeroToOCLEvent:
llvm_unreachable("invalid cast kind for complex value");
case CK_FloatingRealToComplex:
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 2c107cb716..80ab2ed28c 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -747,6 +747,7 @@ public:
case CK_FloatingToIntegral:
case CK_FloatingToBoolean:
case CK_FloatingCast:
+ case CK_ZeroToOCLEvent:
return 0;
}
llvm_unreachable("Invalid CastKind");
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 5715913b6a..ed927e2fb4 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -1383,6 +1383,11 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
return EmitComplexToScalarConversion(V, E->getType(), DestTy);
}
+ case CK_ZeroToOCLEvent: {
+ assert(DestTy->isEventT() && "CK_ZeroToOCLEvent cast on non event type");
+ return llvm::Constant::getNullValue(ConvertType(DestTy));
+ }
+
}
llvm_unreachable("unknown scalar cast");
diff --git a/lib/CodeGen/CGOpenCLRuntime.cpp b/lib/CodeGen/CGOpenCLRuntime.cpp
index bb239c6c3d..215d09640a 100644
--- a/lib/CodeGen/CGOpenCLRuntime.cpp
+++ b/lib/CodeGen/CGOpenCLRuntime.cpp
@@ -55,5 +55,8 @@ llvm::Type *CGOpenCLRuntime::convertOpenCLSpecificType(const Type *T) {
case BuiltinType::OCLImage3d:
return llvm::PointerType::get(llvm::StructType::create(
CGM.getLLVMContext(), "opencl.image3d_t"), 0);
+ case BuiltinType::OCLEvent:
+ return llvm::PointerType::get(llvm::StructType::create(
+ CGM.getLLVMContext(), "opencl.event_t"), 0);
}
}
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp
index 41b73e23cd..3d65892b2e 100644
--- a/lib/CodeGen/CGRTTI.cpp
+++ b/lib/CodeGen/CGRTTI.cpp
@@ -197,6 +197,7 @@ static bool TypeInfoIsInStandardLibrary(const BuiltinType *Ty) {
case BuiltinType::OCLImage2d:
case BuiltinType::OCLImage2dArray:
case BuiltinType::OCLImage3d:
+ case BuiltinType::OCLEvent:
return true;
case BuiltinType::Dependent:
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index 2c5f2d80cf..c186ebff29 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -374,6 +374,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
case BuiltinType::OCLImage2d:
case BuiltinType::OCLImage2dArray:
case BuiltinType::OCLImage3d:
+ case BuiltinType::OCLEvent:
ResultType = CGM.getOpenCLRuntime().convertOpenCLSpecificType(Ty);
break;
diff --git a/lib/Edit/RewriteObjCFoundationAPI.cpp b/lib/Edit/RewriteObjCFoundationAPI.cpp
index 312c86fe9b..215aacdad1 100644
--- a/lib/Edit/RewriteObjCFoundationAPI.cpp
+++ b/lib/Edit/RewriteObjCFoundationAPI.cpp
@@ -1075,6 +1075,7 @@ static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg,
case CK_NonAtomicToAtomic:
case CK_CopyAndAutoreleaseBlockObject:
case CK_BuiltinFnToFnPtr:
+ case CK_ZeroToOCLEvent:
return false;
}
}
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index f9c68c79b9..cfe5d1b16a 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -2783,6 +2783,10 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_image3d_t, Loc,
PrevSpec, DiagID);
break;
+ case tok::kw_event_t:
+ isInvalid = DS.SetTypeSpecType(DeclSpec::TST_event_t, Loc,
+ PrevSpec, DiagID);
+ break;
case tok::kw___unknown_anytype:
isInvalid = DS.SetTypeSpecType(TST_unknown_anytype, Loc,
PrevSpec, DiagID);
@@ -3633,6 +3637,7 @@ bool Parser::isKnownToBeTypeSpecifier(const Token &Tok) const {
case tok::kw_image2d_t:
case tok::kw_image2d_array_t:
case tok::kw_image3d_t:
+ case tok::kw_event_t:
// struct-or-union-specifier (C99) or class-specifier (C++)
case tok::kw_class:
@@ -3713,6 +3718,7 @@ bool Parser::isTypeSpecifierQualifier() {
case tok::kw_image2d_t:
case tok::kw_image2d_array_t:
case tok::kw_image3d_t:
+ case tok::kw_event_t:
// struct-or-union-specifier (C99) or class-specifier (C++)
case tok::kw_class:
@@ -3865,6 +3871,7 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
case tok::kw_image2d_t:
case tok::kw_image2d_array_t:
case tok::kw_image3d_t:
+ case tok::kw_event_t:
// struct-or-union-specifier (C99) or class-specifier (C++)
case tok::kw_class:
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index d6d38c758a..9c788a1336 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -1024,6 +1024,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
case tok::kw_image2d_t:
case tok::kw_image2d_array_t:
case tok::kw_image3d_t: {
+ case tok::kw_event_t:
if (!getLangOpts().CPlusPlus) {
Diag(Tok, diag::err_expected_expression);
return ExprError();
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index 78d73bca4c..1116daa4d1 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -843,6 +843,7 @@ Parser::isExpressionOrTypeSpecifierSimple(tok::TokenKind Kind) {
case tok::kw_image2d_t:
case tok::kw_image2d_array_t:
case tok::kw_image3d_t:
+ case tok::kw_event_t:
case tok::kw___unknown_anytype:
return TPResult::False();
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp
index 35b0736196..6d30b89952 100644
--- a/lib/Sema/DeclSpec.cpp
+++ b/lib/Sema/DeclSpec.cpp
@@ -286,6 +286,7 @@ bool Declarator::isDeclarationOfFunction() const {
case TST_image2d_t:
case TST_image2d_array_t:
case TST_image3d_t:
+ case TST_event_t:
return false;
case TST_decltype:
@@ -427,6 +428,7 @@ const char *DeclSpec::getSpecifierName(DeclSpec::TST T) {
case DeclSpec::TST_image2d_t: return "image2d_t";
case DeclSpec::TST_image2d_array_t: return "image2d_array_t";
case DeclSpec::TST_image3d_t: return "image3d_t";
+ case DeclSpec::TST_event_t: return "event_t";
case DeclSpec::TST_error: return "(error)";
}
llvm_unreachable("Unknown typespec!");
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index dbdbc3d6a2..7936efa136 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -4401,6 +4401,22 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
SC = SC_OpenCLWorkGroupLocal;
SCAsWritten = SC_OpenCLWorkGroupLocal;
}
+
+ // OpenCL 1.2 spec, p6.9 r:
+ // The event type cannot be used to declare a program sc