diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 62 | ||||
-rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Parse/ParseTentative.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/DeclSpec.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 18 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateVariadic.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 32 |
7 files changed, 19 insertions, 135 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 9c2362fe126..e8149d3c9fd 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -3173,38 +3173,6 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, case tok::kw___pixel: isInvalid = DS.SetTypeAltiVecPixel(true, Loc, PrevSpec, DiagID); break; - case tok::kw_image1d_t: - isInvalid = DS.SetTypeSpecType(DeclSpec::TST_image1d_t, Loc, - PrevSpec, DiagID); - break; - case tok::kw_image1d_array_t: - isInvalid = DS.SetTypeSpecType(DeclSpec::TST_image1d_array_t, Loc, - PrevSpec, DiagID); - break; - case tok::kw_image1d_buffer_t: - isInvalid = DS.SetTypeSpecType(DeclSpec::TST_image1d_buffer_t, Loc, - PrevSpec, DiagID); - break; - case tok::kw_image2d_t: - isInvalid = DS.SetTypeSpecType(DeclSpec::TST_image2d_t, Loc, - PrevSpec, DiagID); - break; - case tok::kw_image2d_array_t: - isInvalid = DS.SetTypeSpecType(DeclSpec::TST_image2d_array_t, Loc, - PrevSpec, DiagID); - break; - case tok::kw_image3d_t: - isInvalid = DS.SetTypeSpecType(DeclSpec::TST_image3d_t, Loc, - PrevSpec, DiagID); - break; - case tok::kw_sampler_t: - isInvalid = DS.SetTypeSpecType(DeclSpec::TST_sampler_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); @@ -4056,16 +4024,6 @@ bool Parser::isKnownToBeTypeSpecifier(const Token &Tok) const { case tok::kw__Decimal128: case tok::kw___vector: - // OpenCL specific types: - case tok::kw_image1d_t: - case tok::kw_image1d_array_t: - case tok::kw_image1d_buffer_t: - case tok::kw_image2d_t: - case tok::kw_image2d_array_t: - case tok::kw_image3d_t: - case tok::kw_sampler_t: - case tok::kw_event_t: - // struct-or-union-specifier (C99) or class-specifier (C++) case tok::kw_class: case tok::kw_struct: @@ -4138,16 +4096,6 @@ bool Parser::isTypeSpecifierQualifier() { case tok::kw__Decimal128: case tok::kw___vector: - // OpenCL specific types: - case tok::kw_image1d_t: - case tok::kw_image1d_array_t: - case tok::kw_image1d_buffer_t: - case tok::kw_image2d_t: - case tok::kw_image2d_array_t: - case tok::kw_image3d_t: - case tok::kw_sampler_t: - case tok::kw_event_t: - // struct-or-union-specifier (C99) or class-specifier (C++) case tok::kw_class: case tok::kw_struct: @@ -4288,16 +4236,6 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { case tok::kw__Decimal128: case tok::kw___vector: - // OpenCL specific types: - case tok::kw_image1d_t: - case tok::kw_image1d_array_t: - case tok::kw_image1d_buffer_t: - case tok::kw_image2d_t: - case tok::kw_image2d_array_t: - case tok::kw_image3d_t: - case tok::kw_sampler_t: - case tok::kw_event_t: - // struct-or-union-specifier (C99) or class-specifier (C++) case tok::kw_class: case tok::kw_struct: diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 7ace1f63d95..db66ac52ffc 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -988,15 +988,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, case tok::kw_void: case tok::kw_typename: case tok::kw_typeof: - case tok::kw___vector: - case tok::kw_image1d_t: - case tok::kw_image1d_array_t: - case tok::kw_image1d_buffer_t: - case tok::kw_image2d_t: - case tok::kw_image2d_array_t: - case tok::kw_image3d_t: - case tok::kw_sampler_t: - case tok::kw_event_t: { + case tok::kw___vector: { if (!getLangOpts().CPlusPlus) { Diag(Tok, diag::err_expected_expression); return ExprError(); diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp index 59118b0fd3f..0bf1f095725 100644 --- a/clang/lib/Parse/ParseTentative.cpp +++ b/clang/lib/Parse/ParseTentative.cpp @@ -991,14 +991,6 @@ Parser::isExpressionOrTypeSpecifierSimple(tok::TokenKind Kind) { case tok::kw___vector: case tok::kw___pixel: case tok::kw__Atomic: - case tok::kw_image1d_t: - case tok::kw_image1d_array_t: - case tok::kw_image1d_buffer_t: - case tok::kw_image2d_t: - case tok::kw_image2d_array_t: - case tok::kw_image3d_t: - case tok::kw_sampler_t: - case tok::kw_event_t: case tok::kw___unknown_anytype: return TPResult::False(); diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index c2f16157b8e..d23df82be50 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -285,14 +285,6 @@ bool Declarator::isDeclarationOfFunction() const { case TST_unspecified: case TST_void: case TST_wchar: - case TST_image1d_t: - case TST_image1d_array_t: - case TST_image1d_buffer_t: - case TST_image2d_t: - case TST_image2d_array_t: - case TST_image3d_t: - case TST_sampler_t: - case TST_event_t: return false; case TST_decltype_auto: @@ -457,14 +449,6 @@ const char *DeclSpec::getSpecifierName(DeclSpec::TST T) { case DeclSpec::TST_underlyingType: return "__underlying_type"; case DeclSpec::TST_unknown_anytype: return "__unknown_anytype"; case DeclSpec::TST_atomic: return "_Atomic"; - case DeclSpec::TST_image1d_t: return "image1d_t"; - case DeclSpec::TST_image1d_array_t: return "image1d_array_t"; - case DeclSpec::TST_image1d_buffer_t: return "image1d_buffer_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_sampler_t: return "sampler_t"; - case DeclSpec::TST_event_t: return "event_t"; case DeclSpec::TST_error: return "(error)"; } llvm_unreachable("Unknown typespec!"); diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 4d01fb0a6be..9a00783da1e 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -120,6 +120,12 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, InitDataSharingAttributesStack(); } +void Sema::addImplicitTypedef(StringRef Name, QualType T) { + DeclarationName DN = &Context.Idents.get(Name); + if (IdResolver.begin(DN) == IdResolver.end()) + PushOnScopeChains(Context.buildImplicitTypedef(T, Name), TUScope); +} + void Sema::Initialize() { // Tell the AST consumer about this Sema object. Consumer.Initialize(Context); @@ -172,6 +178,18 @@ void Sema::Initialize() { PushOnScopeChains(Context.getObjCProtocolDecl(), TUScope); } + // Initialize predefined OpenCL types. + if (PP.getLangOpts().OpenCL) { + addImplicitTypedef("image1d_t", Context.OCLImage1dTy); + addImplicitTypedef("image1d_array_t", Context.OCLImage1dArrayTy); + addImplicitTypedef("image1d_buffer_t", Context.OCLImage1dBufferTy); + addImplicitTypedef("image2d_t", Context.OCLImage2dTy); + addImplicitTypedef("image2d_array_t", Context.OCLImage2dArrayTy); + addImplicitTypedef("image3d_t", Context.OCLImage3dTy); + addImplicitTypedef("sampler_t", Context.OCLSamplerTy); + addImplicitTypedef("event_t", Context.OCLEventTy); + } + DeclarationName BuiltinVaList = &Context.Idents.get("__builtin_va_list"); if (IdResolver.begin(BuiltinVaList) == IdResolver.end()) PushOnScopeChains(Context.getBuiltinVaListDecl(), TUScope); diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index 78aa7f893a1..d41c6d6a9a9 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -730,14 +730,6 @@ bool Sema::containsUnexpandedParameterPacks(Declarator &D) { case TST_auto: case TST_decltype_auto: case TST_unknown_anytype: - case TST_image1d_t: - case TST_image1d_array_t: - case TST_image1d_buffer_t: - case TST_image2d_t: - case TST_image2d_array_t: - case TST_image3d_t: - case TST_sampler_t: - case TST_event_t: case TST_error: break; } diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index e6a49f5d3f3..59b965b38c9 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1058,38 +1058,6 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { } break; - case DeclSpec::TST_image1d_t: - Result = Context.OCLImage1dTy; - break; - - case DeclSpec::TST_image1d_array_t: - Result = Context.OCLImage1dArrayTy; - break; - - case DeclSpec::TST_image1d_buffer_t: - Result = Context.OCLImage1dBufferTy; - break; - - case DeclSpec::TST_image2d_t: - Result = Context.OCLImage2dTy; - break; - - case DeclSpec::TST_image2d_array_t: - Result = Context.OCLImage2dArrayTy; - break; - - case DeclSpec::TST_image3d_t: - Result = Context.OCLImage3dTy; - break; - - case DeclSpec::TST_sampler_t: - Result = Context.OCLSamplerTy; - break; - - case DeclSpec::TST_event_t: - Result = Context.OCLEventTy; - break; - case DeclSpec::TST_error: Result = Context.IntTy; declarator.setInvalidType(true); |