diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index e28ec936e4c2f..f65f8e3f2b50b 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -13957,20 +13957,6 @@ class Sema final { SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc, unsigned DiagID); - /// Check whether we're allowed to call Callee from the current context. - /// - /// - If the call is never allowed in a semantically-correct program - /// emits an error and returns false. - /// - /// - If the call is allowed in semantically-correct programs, but only if - /// it's never codegen'ed, creates a deferred diagnostic to be emitted if - /// and when the caller is codegen'ed, and returns true. - /// - /// - Otherwise, returns true without emitting any diagnostics. - /// - /// Adds Callee to DeviceCallGraph if we don't know if its caller will be - /// codegen'ed yet. - bool checkSYCLDeviceFunction(SourceLocation Loc, FunctionDecl *Callee); void deepTypeCheckForSYCLDevice(SourceLocation UsedAt, llvm::DenseSet Visited, ValueDecl *DeclToCheck); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 31936bce78621..4efa1b408607d 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -15672,9 +15672,6 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, MarkFunctionReferenced(ConstructLoc, Constructor); if (getLangOpts().CUDA && !CheckCUDACall(ConstructLoc, Constructor)) return ExprError(); - if (getLangOpts().SYCLIsDevice && - !checkSYCLDeviceFunction(ConstructLoc, Constructor)) - return ExprError(); return CheckForImmediateInvocation( CXXConstructExpr::Create( diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index ec0f31e489d5b..2e463346e70ff 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -309,8 +309,6 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef Locs, if (getLangOpts().CUDA && !CheckCUDACall(Loc, FD)) return true; - if (getLangOpts().SYCLIsDevice && !checkSYCLDeviceFunction(Loc, FD)) - return true; } if (auto *MD = dyn_cast(D)) { @@ -18468,9 +18466,6 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, if (getLangOpts().CUDA) CheckCUDACall(Loc, Func); - if (getLangOpts().SYCLIsDevice) - checkSYCLDeviceFunction(Loc, Func); - // If we need a definition, try to create one. if (NeedDefinition && !Func->getBody()) { runWithSufficientStackSpace(Loc, [&] { diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp index f8c713c8545d9..ca0254d29e7f4 100644 --- a/clang/lib/Sema/SemaSYCL.cpp +++ b/clang/lib/Sema/SemaSYCL.cpp @@ -33,22 +33,6 @@ Sema::SemaDiagnosticBuilder Sema::SYCLDiagIfDeviceCode(SourceLocation Loc, return SemaDiagnosticBuilder(DiagKind, Loc, DiagID, FD, *this); } -bool Sema::checkSYCLDeviceFunction(SourceLocation Loc, FunctionDecl *Callee) { - assert(getLangOpts().SYCLIsDevice && - "Should only be called during SYCL compilation"); - assert(Callee && "Callee may not be null."); - - // Errors in an unevaluated context don't need to be generated, - // so we can safely skip them. - if (isUnevaluatedContext() || isConstantEvaluated()) - return true; - - SemaDiagnosticBuilder::Kind DiagKind = SemaDiagnosticBuilder::K_Nop; - - return DiagKind != SemaDiagnosticBuilder::K_Immediate && - DiagKind != SemaDiagnosticBuilder::K_ImmediateWithCallStack; -} - static bool isZeroSizedArray(Sema &SemaRef, QualType Ty) { if (const auto *CAT = SemaRef.getASTContext().getAsConstantArrayType(Ty)) return CAT->getSize() == 0;