[clang] [clang] Introduce `SemaSYCL` (PR #88086)

Harald van Dijk via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 10:26:21 PDT 2024


================
@@ -0,0 +1,66 @@
+//===----- SemaOpenACC.h 000- 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 that this function will be codegen'ed
+  ///   for devive yet, creates a diagnostic which is emitted if and when we
----------------
hvdijk wrote:

This took me a moment longer to parse than it should. I realise you only moved it, this is not newly written by you, but maybe good to update at the same time by moving the "yet" to the front to make it clear and unambiguous that it applies to the "know", not to the "emitted":
```suggestion
  ///   for the device, but we don't know yet that this function will be codegen'ed
  ///   for the device, creates a diagnostic which is emitted if and when we
```

https://github.com/llvm/llvm-project/pull/88086


More information about the cfe-commits mailing list