[clang] ca06638 - [SYCL][NFC] Remove dead code
Elizabeth Andrews via cfe-commits
cfe-commits at lists.llvm.org
Mon May 8 13:08:45 PDT 2023
Author: Elizabeth Andrews
Date: 2023-05-08T13:08:23-07:00
New Revision: ca06638bbbf42a511d1be141fc7c547c7995ed29
URL: https://github.com/llvm/llvm-project/commit/ca06638bbbf42a511d1be141fc7c547c7995ed29
DIFF: https://github.com/llvm/llvm-project/commit/ca06638bbbf42a511d1be141fc7c547c7995ed29.diff
LOG: [SYCL][NFC] Remove dead code
Added:
Modified:
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaSYCL.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index e28ec936e4c2..f65f8e3f2b50 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<QualType> Visited,
ValueDecl *DeclToCheck);
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 31936bce7862..4efa1b408607 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 ec0f31e489d5..2e463346e70f 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -309,8 +309,6 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
if (getLangOpts().CUDA && !CheckCUDACall(Loc, FD))
return true;
- if (getLangOpts().SYCLIsDevice && !checkSYCLDeviceFunction(Loc, FD))
- return true;
}
if (auto *MD = dyn_cast<CXXMethodDecl>(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 f8c713c8545d..ca0254d29e7f 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;
More information about the cfe-commits
mailing list