Anastasia created this revision. Anastasia added reviewers: svenvh, yaxunl, mantognini. Herald added subscribers: ebevhan, mgrang. Anastasia requested review of this revision.
The current implementation of extension pragma is not conformant to the spec as it does not disable anything and therefore enabling non-disabled logic has no meaning. The implementation doesn't respect the following requirement from OpenCL Extension spec s1.2: https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#extensions-overview > **disable** Behave (including issuing errors and warnings) as if the > extension extension_name is not part of the language definition. This means that extension functionality should not be exposed by default and if extension identifiers are not reserved they should not be recognized by the compiler. Fixing the behavior doesn't seem easy in C/C++-based parsing as it requires dynamic loading and unloading functionality. In C/C++-based languages, this has never been considered and they provide dedicated language features for loading i.e. include files, namespaces, etc. I don't know languages that actually support such a feature. In GLSL from where the initial idea came from the loading and unloading of extension functionality is constrained to be only available before parsing of the shading sourcing is done. Considering the severe limitations I would like to drop maintaining this code now especially because of its interference with OpenCL 3.0. If we decide to implement this behavior (although it doesn't seem likely) we should provide the complete fully functional implementation. The desired logic for exposing extension functionality conditionally can be easily achieved by using the extension macros definition/guards and header files. https://reviews.llvm.org/D101043 Files: clang/include/clang/Basic/DiagnosticParseKinds.td clang/include/clang/Basic/DiagnosticSemaKinds.td clang/include/clang/Sema/Overload.h clang/include/clang/Sema/Sema.h clang/include/clang/Serialization/ASTWriter.h clang/lib/Parse/ParsePragma.cpp clang/lib/Parse/Parser.cpp clang/lib/Sema/Sema.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaType.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/test/CodeGenOpenCL/extension-begin.cl clang/test/SemaOpenCL/extension-begin.cl clang/test/SemaOpenCL/extension-begin.h
Index: clang/test/SemaOpenCL/extension-begin.h =================================================================== --- clang/test/SemaOpenCL/extension-begin.h +++ clang/test/SemaOpenCL/extension-begin.h @@ -5,10 +5,13 @@ #pragma OPENCL EXTENSION all : end #pragma OPENCL EXTENSION my_ext : begin - struct A { int a; }; +#pragma OPENCL EXTENSION my_ext : end +#pragma OPENCL EXTENSION my_ext : end + +#define my_ext typedef struct A TypedefOfA; typedef const __private TypedefOfA* PointerOfA; @@ -17,10 +20,8 @@ __attribute__((overloadable)) void g(long x); -#pragma OPENCL EXTENSION my_ext : end -#pragma OPENCL EXTENSION my_ext : end + __attribute__((overloadable)) void g(void); #endif // INCLUDED - Index: clang/test/SemaOpenCL/extension-begin.cl =================================================================== --- clang/test/SemaOpenCL/extension-begin.cl +++ clang/test/SemaOpenCL/extension-begin.cl @@ -29,25 +29,23 @@ #ifndef USE_PCH // expected-warning@extension-begin.h:4 {{expected 'disable' - ignoring}} // expected-warning@extension-begin.h:5 {{expected 'disable' - ignoring}} -// expected-warning@extension-begin.h:21 {{OpenCL extension end directive mismatches begin directive - ignoring}} #endif // USE_PCH +#if defined(IMPLICIT_INCLUDE) && defined(USE_PCH) +//expected-no-diagnostics +#endif + +// Tests that the pragmas are accepted for backward compatibility. #pragma OPENCL EXTENSION my_ext : enable -void test_f1(void) { +#pragma OPENCL EXTENSION my_ext : disable + +#ifndef my_ext +#error "Missing my_ext macro" +#endif + +// When extension is supported its functionality can be used freely. +void test(void) { struct A test_A1; f(); g(0); } - -#pragma OPENCL EXTENSION my_ext : disable -void test_f2(void) { - struct A test_A2; // expected-error {{use of type 'struct A' requires my_ext support}} - const struct A test_A_local; // expected-error {{use of type 'struct A' requires my_ext support}} - TypedefOfA test_typedef_A; // expected-error {{use of type 'TypedefOfA' (aka 'struct A') requires my_ext support}} - PointerOfA test_A_pointer; // expected-error {{use of type 'PointerOfA' (aka 'const __private struct A *') requires my_ext support}} - f(); // expected-error {{use of declaration 'f' requires my_ext support}} - g(0); // expected-error {{no matching function for call to 'g'}} - // expected-note@extension-begin.h:18 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be enabled}} - // expected-note@extension-begin.h:23 {{candidate function not viable: requires 0 arguments, but 1 was provided}} -} - Index: clang/test/CodeGenOpenCL/extension-begin.cl =================================================================== --- clang/test/CodeGenOpenCL/extension-begin.cl +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -o - | FileCheck %s - -__attribute__((overloadable)) void f(int x); - -#pragma OPENCL EXTENSION my_ext : begin - -__attribute__((overloadable)) void f(long x); - -#pragma OPENCL EXTENSION my_ext : end - -#pragma OPENCL EXTENSION my_ext : enable - -//CHECK: define{{.*}} spir_func void @test_f1(i64 %x) -//CHECK: call spir_func void @_Z1fl(i64 %{{.*}}) -void test_f1(long x) { - f(x); -} - -#pragma OPENCL EXTENSION my_ext : disable - -//CHECK: define{{.*}} spir_func void @test_f2(i64 %x) -//CHECK: call spir_func void @_Z1fi(i32 %{{.*}}) -void test_f2(long x) { - f(x); -} Index: clang/lib/Serialization/ASTWriter.cpp =================================================================== --- clang/lib/Serialization/ASTWriter.cpp +++ clang/lib/Serialization/ASTWriter.cpp @@ -3965,72 +3965,6 @@ } Stream.EmitRecord(OPENCL_EXTENSIONS, Record); } - -void ASTWriter::WriteOpenCLExtensionTypes(Sema &SemaRef) { - if (!SemaRef.Context.getLangOpts().OpenCL) - return; - - // Sort the elements of the map OpenCLTypeExtMap by TypeIDs, - // without copying them. - const llvm::DenseMap<const Type *, std::set<std::string>> &OpenCLTypeExtMap = - SemaRef.OpenCLTypeExtMap; - using ElementTy = std::pair<TypeID, const std::set<std::string> *>; - llvm::SmallVector<ElementTy, 8> StableOpenCLTypeExtMap; - StableOpenCLTypeExtMap.reserve(OpenCLTypeExtMap.size()); - - for (const auto &I : OpenCLTypeExtMap) - StableOpenCLTypeExtMap.emplace_back( - getTypeID(I.first->getCanonicalTypeInternal()), &I.second); - - auto CompareByTypeID = [](const ElementTy &E1, const ElementTy &E2) -> bool { - return E1.first < E2.first; - }; - llvm::sort(StableOpenCLTypeExtMap, CompareByTypeID); - - RecordData Record; - for (const ElementTy &E : StableOpenCLTypeExtMap) { - Record.push_back(E.first); // TypeID - const std::set<std::string> *ExtSet = E.second; - Record.push_back(static_cast<unsigned>(ExtSet->size())); - for (const std::string &Ext : *ExtSet) - AddString(Ext, Record); - } - - Stream.EmitRecord(OPENCL_EXTENSION_TYPES, Record); -} - -void ASTWriter::WriteOpenCLExtensionDecls(Sema &SemaRef) { - if (!SemaRef.Context.getLangOpts().OpenCL) - return; - - // Sort the elements of the map OpenCLDeclExtMap by DeclIDs, - // without copying them. - const llvm::DenseMap<const Decl *, std::set<std::string>> &OpenCLDeclExtMap = - SemaRef.OpenCLDeclExtMap; - using ElementTy = std::pair<DeclID, const std::set<std::string> *>; - llvm::SmallVector<ElementTy, 8> StableOpenCLDeclExtMap; - StableOpenCLDeclExtMap.reserve(OpenCLDeclExtMap.size()); - - for (const auto &I : OpenCLDeclExtMap) - StableOpenCLDeclExtMap.emplace_back(getDeclID(I.first), &I.second); - - auto CompareByDeclID = [](const ElementTy &E1, const ElementTy &E2) -> bool { - return E1.first < E2.first; - }; - llvm::sort(StableOpenCLDeclExtMap, CompareByDeclID); - - RecordData Record; - for (const ElementTy &E : StableOpenCLDeclExtMap) { - Record.push_back(E.first); // DeclID - const std::set<std::string> *ExtSet = E.second; - Record.push_back(static_cast<unsigned>(ExtSet->size())); - for (const std::string &Ext : *ExtSet) - AddString(Ext, Record); - } - - Stream.EmitRecord(OPENCL_EXTENSION_DECLS, Record); -} - void ASTWriter::WriteCUDAPragmas(Sema &SemaRef) { if (SemaRef.ForceCUDAHostDeviceDepth > 0) { RecordData::value_type Record[] = {SemaRef.ForceCUDAHostDeviceDepth}; @@ -4775,17 +4709,12 @@ WriteIdentifierTable(PP, SemaRef.IdResolver, isModule); WriteFPPragmaOptions(SemaRef.CurFPFeatureOverrides()); WriteOpenCLExtensions(SemaRef); - WriteOpenCLExtensionTypes(SemaRef); WriteCUDAPragmas(SemaRef); // If we're emitting a module, write out the submodule information. if (WritingModule) WriteSubmodules(WritingModule); - // We need to have information about submodules to correctly deserialize - // decls from OpenCLExtensionDecls block - WriteOpenCLExtensionDecls(SemaRef); - Stream.EmitRecord(SPECIAL_TYPES, SpecialTypes); // Write the record containing external, unnamed definitions. Index: clang/lib/Serialization/ASTReader.cpp =================================================================== --- clang/lib/Serialization/ASTReader.cpp +++ clang/lib/Serialization/ASTReader.cpp @@ -3636,30 +3636,6 @@ } break; - case OPENCL_EXTENSION_TYPES: - for (unsigned I = 0, E = Record.size(); I != E;) { - auto TypeID = static_cast<::TypeID>(Record[I++]); - auto *Type = GetType(TypeID).getTypePtr(); - auto NumExt = static_cast<unsigned>(Record[I++]); - for (unsigned II = 0; II != NumExt; ++II) { - auto Ext = ReadString(Record, I); - OpenCLTypeExtMap[Type].insert(Ext); - } - } - break; - - case OPENCL_EXTENSION_DECLS: - for (unsigned I = 0, E = Record.size(); I != E;) { - auto DeclID = static_cast<::DeclID>(Record[I++]); - auto *Decl = GetDecl(DeclID); - auto NumExt = static_cast<unsigned>(Record[I++]); - for (unsigned II = 0; II != NumExt; ++II) { - auto Ext = ReadString(Record, I); - OpenCLDeclExtMap[Decl].insert(Ext); - } - } - break; - case TENTATIVE_DEFINITIONS: for (unsigned I = 0, N = Record.size(); I != N; ++I) TentativeDefinitions.push_back(getGlobalDeclID(F, Record[I])); @@ -7893,8 +7869,6 @@ } SemaObj->OpenCLFeatures = OpenCLExtensions; - SemaObj->OpenCLTypeExtMap = OpenCLTypeExtMap; - SemaObj->OpenCLDeclExtMap = OpenCLDeclExtMap; UpdateSema(); } Index: clang/lib/Sema/SemaType.cpp =================================================================== --- clang/lib/Sema/SemaType.cpp +++ clang/lib/Sema/SemaType.cpp @@ -1725,10 +1725,6 @@ declarator.setInvalidType(); } - if (S.getLangOpts().OpenCL && - S.checkOpenCLDisabledTypeDeclSpec(DS, Result)) - declarator.setInvalidType(true); - bool IsFixedPointType = DS.getTypeSpecType() == DeclSpec::TST_accum || DS.getTypeSpecType() == DeclSpec::TST_fract; Index: clang/lib/Sema/SemaOverload.cpp =================================================================== --- clang/lib/Sema/SemaOverload.cpp +++ clang/lib/Sema/SemaOverload.cpp @@ -6481,12 +6481,6 @@ Candidate.DeductionFailure.Data = FailedAttr; return; } - - if (LangOpts.OpenCL && isOpenCLDisabledDecl(Function)) { - Candidate.Viable = false; - Candidate.FailureKind = ovl_fail_ext_disabled; - return; - } } ObjCMethodDecl * @@ -11091,14 +11085,6 @@ << (ES.getExpr() ? ES.getExpr()->getSourceRange() : SourceRange()); } -static void DiagnoseOpenCLExtensionDisabled(Sema &S, OverloadCandidate *Cand) { - FunctionDecl *Callee = Cand->Function; - - S.Diag(Callee->getLocation(), - diag::note_ovl_candidate_disabled_by_extension) - << S.getOpenCLExtensionsFromDeclExtMap(Callee); -} - /// Generates a 'note' diagnostic for an overload candidate. We've /// already generated a primary error at the call site. /// @@ -11194,9 +11180,6 @@ case ovl_fail_explicit: return DiagnoseFailedExplicitSpec(S, Cand); - case ovl_fail_ext_disabled: - return DiagnoseOpenCLExtensionDisabled(S, Cand); - case ovl_fail_inhctor_slice: // It's generally not interesting to note copy/move constructors here. if (cast<CXXConstructorDecl>(Fn)->isCopyOrMoveConstructor()) Index: clang/lib/Sema/SemaExpr.cpp =================================================================== --- clang/lib/Sema/SemaExpr.cpp +++ clang/lib/Sema/SemaExpr.cpp @@ -6487,9 +6487,6 @@ FD, /*Complain=*/true, Fn->getBeginLoc())) return ExprError(); - if (getLangOpts().OpenCL && checkOpenCLDisabledDecl(*FD, *Fn)) - return ExprError(); - checkDirectCallValidity(*this, Fn, FD, ArgExprs); } Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -5566,9 +5566,6 @@ Dcl && Dcl->getDeclContext()->isFileContext()) Dcl->setTopLevelDeclInObjCContainer(); - if (getLangOpts().OpenCL) - setCurrentOpenCLExtensionForDecl(Dcl); - return Dcl; } Index: clang/lib/Sema/Sema.cpp =================================================================== --- clang/lib/Sema/Sema.cpp +++ clang/lib/Sema/Sema.cpp @@ -366,7 +366,6 @@ #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ if (getOpenCLOptions().isSupported(#Ext, getLangOpts())) { \ addImplicitTypedef(#ExtType, Context.Id##Ty); \ - setOpenCLExtensionForType(Context.Id##Ty, #Ext); \ } #include "clang/Basic/OpenCLExtensionTypes.def" } @@ -2462,115 +2461,3 @@ Sema::getMismatchingDeleteExpressions() const { return DeleteExprs; } - -void Sema::setOpenCLExtensionForType(QualType T, llvm::StringRef ExtStr) { - if (ExtStr.empty()) - return; - llvm::SmallVector<StringRef, 1> Exts; - ExtStr.split(Exts, " ", /* limit */ -1, /* keep empty */ false); - auto CanT = T.getCanonicalType().getTypePtr(); - for (auto &I : Exts) - OpenCLTypeExtMap[CanT].insert(I.str()); -} - -void Sema::setOpenCLExtensionForDecl(Decl *FD, StringRef ExtStr) { - llvm::SmallVector<StringRef, 1> Exts; - ExtStr.split(Exts, " ", /* limit */ -1, /* keep empty */ false); - if (Exts.empty()) - return; - for (auto &I : Exts) - OpenCLDeclExtMap[FD].insert(I.str()); -} - -void Sema::setCurrentOpenCLExtensionForType(QualType T) { - if (CurrOpenCLExtension.empty()) - return; - setOpenCLExtensionForType(T, CurrOpenCLExtension); -} - -void Sema::setCurrentOpenCLExtensionForDecl(Decl *D) { - if (CurrOpenCLExtension.empty()) - return; - setOpenCLExtensionForDecl(D, CurrOpenCLExtension); -} - -std::string Sema::getOpenCLExtensionsFromDeclExtMap(FunctionDecl *FD) { - if (!OpenCLDeclExtMap.empty()) - return getOpenCLExtensionsFromExtMap(FD, OpenCLDeclExtMap); - - return ""; -} - -std::string Sema::getOpenCLExtensionsFromTypeExtMap(FunctionType *FT) { - if (!OpenCLTypeExtMap.empty()) - return getOpenCLExtensionsFromExtMap(FT, OpenCLTypeExtMap); - - return ""; -} - -template <typename T, typename MapT> -std::string Sema::getOpenCLExtensionsFromExtMap(T *FDT, MapT &Map) { - auto Loc = Map.find(FDT); - return llvm::join(Loc->second, " "); -} - -bool Sema::isOpenCLDisabledDecl(Decl *FD) { - auto Loc = OpenCLDeclExtMap.find(FD); - if (Loc == OpenCLDeclExtMap.end()) - return false; - for (auto &I : Loc->second) { - if (!getOpenCLOptions().isAvailableOption(I, getLangOpts())) - return true; - } - return false; -} - -template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT> -bool Sema::checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc, - DiagInfoT DiagInfo, MapT &Map, - unsigned Selector, - SourceRange SrcRange) { - auto Loc = Map.find(D); - if (Loc == Map.end()) - return false; - bool Disabled = false; - for (auto &I : Loc->second) { - if (I != CurrOpenCLExtension && - !getOpenCLOptions().isAvailableOption(I, getLangOpts())) { - Diag(DiagLoc, diag::err_opencl_requires_extension) << Selector << DiagInfo - << I << SrcRange; - Disabled = true; - } - } - return Disabled; -} - -bool Sema::checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DS, QualType QT) { - // Check extensions for declared types. - Decl *Decl = nullptr; - if (auto TypedefT = dyn_cast<TypedefType>(QT.getTypePtr())) - Decl = TypedefT->getDecl(); - if (auto TagT = dyn_cast<TagType>(QT.getCanonicalType().getTypePtr())) - Decl = TagT->getDecl(); - auto Loc = DS.getTypeSpecTypeLoc(); - - // Check extensions for vector types. - // e.g. double4 is not allowed when cl_khr_fp64 is absent. - if (QT->isExtVectorType()) { - auto TypePtr = QT->castAs<ExtVectorType>()->getElementType().getTypePtr(); - return checkOpenCLDisabledTypeOrDecl(TypePtr, Loc, QT, OpenCLTypeExtMap); - } - - if (checkOpenCLDisabledTypeOrDecl(Decl, Loc, QT, OpenCLDeclExtMap)) - return true; - - // Check extensions for builtin types. - return checkOpenCLDisabledTypeOrDecl(QT.getCanonicalType().getTypePtr(), Loc, - QT, OpenCLTypeExtMap); -} - -bool Sema::checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E) { - IdentifierInfo *FnName = D.getIdentifier(); - return checkOpenCLDisabledTypeOrDecl(&D, E.getBeginLoc(), FnName, - OpenCLDeclExtMap, 1, D.getSourceRange()); -} Index: clang/lib/Parse/Parser.cpp =================================================================== --- clang/lib/Parse/Parser.cpp +++ clang/lib/Parse/Parser.cpp @@ -1079,8 +1079,6 @@ Decl *TheDecl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS_none, DS, AnonRecord); DS.complete(TheDecl); - if (getLangOpts().OpenCL) - Actions.setCurrentOpenCLExtensionForDecl(TheDecl); if (AnonRecord) { Decl* decls[] = {AnonRecord, TheDecl}; return Actions.BuildDeclaratorGroup(decls); Index: clang/lib/Parse/ParsePragma.cpp =================================================================== --- clang/lib/Parse/ParsePragma.cpp +++ clang/lib/Parse/ParsePragma.cpp @@ -792,11 +792,9 @@ // Therefore, it should never be added by default. Opt.acceptsPragma(Name); } - Actions.setCurrentOpenCLExtension(Name); } else if (State == End) { - if (Name != Actions.getCurrentOpenCLExtension()) - PP.Diag(NameLoc, diag::warn_pragma_begin_end_mismatch); - Actions.setCurrentOpenCLExtension(""); + // There is no behavior for this directive. We only accept this for + // backward compatibility. } else if (!Opt.isKnown(Name) || !Opt.isWithPragma(Name)) PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << Ident; else if (Opt.isSupportedExtension(Name, getLangOpts())) Index: clang/include/clang/Serialization/ASTWriter.h =================================================================== --- clang/include/clang/Serialization/ASTWriter.h +++ clang/include/clang/Serialization/ASTWriter.h @@ -510,8 +510,6 @@ void WriteDeclContextVisibleUpdate(const DeclContext *DC); void WriteFPPragmaOptions(const FPOptionsOverride &Opts); void WriteOpenCLExtensions(Sema &SemaRef); - void WriteOpenCLExtensionTypes(Sema &SemaRef); - void WriteOpenCLExtensionDecls(Sema &SemaRef); void WriteCUDAPragmas(Sema &SemaRef); void WriteObjCCategories(); void WriteLateParsedTemplates(Sema &SemaRef); Index: clang/include/clang/Sema/Sema.h =================================================================== --- clang/include/clang/Sema/Sema.h +++ clang/include/clang/Sema/Sema.h @@ -10130,73 +10130,6 @@ /// potentially-throwing. bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend); - //===--------------------------------------------------------------------===// - // OpenCL extensions. - // -private: - std::string CurrOpenCLExtension; - /// Extensions required by an OpenCL type. - llvm::DenseMap<const Type*, std::set<std::string>> OpenCLTypeExtMap; - /// Extensions required by an OpenCL declaration. - llvm::DenseMap<const Decl*, std::set<std::string>> OpenCLDeclExtMap; -public: - llvm::StringRef getCurrentOpenCLExtension() const { - return CurrOpenCLExtension; - } - - /// Check if a function declaration \p FD associates with any - /// extensions present in OpenCLDeclExtMap and if so return the - /// extension(s) name(s). - std::string getOpenCLExtensionsFromDeclExtMap(FunctionDecl *FD); - - /// Check if a function type \p FT associates with any - /// extensions present in OpenCLTypeExtMap and if so return the - /// extension(s) name(s). - std::string getOpenCLExtensionsFromTypeExtMap(FunctionType *FT); - - /// Find an extension in an appropriate extension map and return its name - template<typename T, typename MapT> - std::string getOpenCLExtensionsFromExtMap(T* FT, MapT &Map); - - void setCurrentOpenCLExtension(llvm::StringRef Ext) { - CurrOpenCLExtension = std::string(Ext); - } - - /// Set OpenCL extensions for a type which can only be used when these - /// OpenCL extensions are enabled. If \p Exts is empty, do nothing. - /// \param Exts A space separated list of OpenCL extensions. - void setOpenCLExtensionForType(QualType T, llvm::StringRef Exts); - - /// Set OpenCL extensions for a declaration which can only be - /// used when these OpenCL extensions are enabled. If \p Exts is empty, do - /// nothing. - /// \param Exts A space separated list of OpenCL extensions. - void setOpenCLExtensionForDecl(Decl *FD, llvm::StringRef Exts); - - /// Set current OpenCL extensions for a type which can only be used - /// when these OpenCL extensions are enabled. If current OpenCL extension is - /// empty, do nothing. - void setCurrentOpenCLExtensionForType(QualType T); - - /// Set current OpenCL extensions for a declaration which - /// can only be used when these OpenCL extensions are enabled. If current - /// OpenCL extension is empty, do nothing. - void setCurrentOpenCLExtensionForDecl(Decl *FD); - - bool isOpenCLDisabledDecl(Decl *FD); - - /// Check if type \p T corresponding to declaration specifier \p DS - /// is disabled due to required OpenCL extensions being disabled. If so, - /// emit diagnostics. - /// \return true if type is disabled. - bool checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DS, QualType T); - - /// Check if declaration \p D used by expression \p E - /// is disabled due to required OpenCL extensions being disabled. If so, - /// emit diagnostics. - /// \return true if type is disabled. - bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E); - //===--------------------------------------------------------------------===// // OpenMP directives and clauses. // @@ -10227,21 +10160,6 @@ /// Pop OpenMP function region for non-capturing function. void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI); - /// Checks if a type or a declaration is disabled due to the owning extension - /// being disabled, and emits diagnostic messages if it is disabled. - /// \param D type or declaration to be checked. - /// \param DiagLoc source location for the diagnostic message. - /// \param DiagInfo information to be emitted for the diagnostic message. - /// \param SrcRange source range of the declaration. - /// \param Map maps type or declaration to the extensions. - /// \param Selector selects diagnostic message: 0 for type and 1 for - /// declaration. - /// \return true if the type or declaration is disabled. - template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT> - bool checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc, DiagInfoT DiagInfo, - MapT &Map, unsigned Selector = 0, - SourceRange SrcRange = SourceRange()); - /// Helper to keep information about the current `omp begin/end declare /// variant` nesting. struct OMPDeclareVariantScope { Index: clang/include/clang/Sema/Overload.h =================================================================== --- clang/include/clang/Sema/Overload.h +++ clang/include/clang/Sema/Overload.h @@ -760,9 +760,6 @@ /// This candidate was not viable because its address could not be taken. ovl_fail_addr_not_available, - /// This candidate was not viable because its OpenCL extension is disabled. - ovl_fail_ext_disabled, - /// This inherited constructor is not viable because it would slice the /// argument. ovl_fail_inhctor_slice, Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -4350,8 +4350,6 @@ ShowInSystemHeader; def note_ovl_candidate_disabled_by_function_cond_attr : Note< "candidate disabled: %0">; -def note_ovl_candidate_disabled_by_extension : Note< - "candidate unavailable as it requires OpenCL extension '%0' to be enabled">; def err_addrof_function_disabled_by_enable_if_attr : Error< "cannot take address of function %0 because it has one or more " "non-tautological enable_if conditions">; Index: clang/include/clang/Basic/DiagnosticParseKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticParseKinds.td +++ clang/include/clang/Basic/DiagnosticParseKinds.td @@ -1239,8 +1239,6 @@ "missing ':' after %0 - ignoring">, InGroup<IgnoredPragmas>; def warn_pragma_expected_predicate : Warning< "expected %select{'enable', 'disable', 'begin' or 'end'|'disable'}0 - ignoring">, InGroup<IgnoredPragmas>; -def warn_pragma_begin_end_mismatch : Warning< - "OpenCL extension end directive mismatches begin directive - ignoring">, InGroup<IgnoredPragmas>; def warn_pragma_unknown_extension : Warning< "unknown OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>; def warn_pragma_unsupported_extension : Warning<
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits