-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch moves SYCL-related `Sema` functions into new `SemaSYCL` class, following the recent example of OpenACC and HLSL. This is a part of the effort to split `Sema`. Additional context can be found in #82217, #84184, #87634.
- Loading branch information
Showing
7 changed files
with
121 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
//===----- SemaSYCL.h ------- Semantic Analysis for SYCL constructs -------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/// \file | ||
/// This file declares semantic analysis for SYCL constructs. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_CLANG_SEMA_SEMASYCL_H | ||
#define LLVM_CLANG_SEMA_SEMASYCL_H | ||
|
||
#include "clang/AST/Decl.h" | ||
#include "clang/AST/Type.h" | ||
#include "clang/Basic/SourceLocation.h" | ||
#include "clang/Sema/Ownership.h" | ||
#include "clang/Sema/SemaBase.h" | ||
#include "llvm/ADT/DenseSet.h" | ||
|
||
namespace clang { | ||
|
||
class SemaSYCL : public SemaBase { | ||
public: | ||
SemaSYCL(Sema &S); | ||
|
||
/// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current | ||
/// context is "used as device code". | ||
/// | ||
/// - If CurLexicalContext is a kernel function or it is known that the | ||
/// function will be emitted for the device, emits the diagnostics | ||
/// immediately. | ||
/// - If CurLexicalContext is a function and we are compiling | ||
/// for the device, but we don't know yet that this function will be | ||
/// codegen'ed for the devive, creates a diagnostic which is emitted if and | ||
/// when we realize that the function will be codegen'ed. | ||
/// | ||
/// Example usage: | ||
/// | ||
/// Diagnose __float128 type usage only from SYCL device code if the current | ||
/// target doesn't support it | ||
/// if (!S.Context.getTargetInfo().hasFloat128Type() && | ||
/// S.getLangOpts().SYCLIsDevice) | ||
/// DiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128"; | ||
SemaDiagnosticBuilder DiagIfDeviceCode(SourceLocation Loc, unsigned DiagID); | ||
|
||
void deepTypeCheckForDevice(SourceLocation UsedAt, | ||
llvm::DenseSet<QualType> Visited, | ||
ValueDecl *DeclToCheck); | ||
|
||
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, | ||
SourceLocation LParen, | ||
SourceLocation RParen, | ||
TypeSourceInfo *TSI); | ||
ExprResult ActOnUniqueStableNameExpr(SourceLocation OpLoc, | ||
SourceLocation LParen, | ||
SourceLocation RParen, | ||
ParsedType ParsedTy); | ||
}; | ||
|
||
} // namespace clang | ||
|
||
#endif // LLVM_CLANG_SEMA_SEMASYCL_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters