https://github.com/hekota closed https://github.com/llvm/llvm-project/pull/96823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,56 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - %s
-verify
+
+export void f1();
+
+export void f1() {}
+
+namespace { // expected-note {{anonymous namespace begins here}}
+export void f2(); // expected-error {{export declaration appear
@@ -0,0 +1,56 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - %s
-verify
+
+export void f1();
+
+export void f1() {}
+
+namespace { // expected-note {{anonymous namespace begins here}}
+export void f2(); // expected-error {{export declaration appear
https://github.com/damyanp approved this pull request.
https://github.com/llvm/llvm-project/pull/96823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/damyanp edited
https://github.com/llvm/llvm-project/pull/96823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/96823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/96823
>From b67ecd20cc2c11f4f99c2d90c95fdbd988659947 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Wed, 26 Jun 2024 12:31:39 -0700
Subject: [PATCH 1/3] [HLSL] Implement `export` keyword
Fixes #92812
---
.../clang/
@@ -924,6 +939,23 @@ static bool checkExportedDeclContext(Sema &S, DeclContext
*DC,
/// Check that it's valid to export \p D.
static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) {
+ // HLSL: export declaration is valid only on functions
+ if (S.getLan
@@ -851,6 +851,21 @@ Decl *Sema::ActOnStartExportDecl(Scope *S, SourceLocation
ExportLoc,
CurContext->addDecl(D);
PushDeclContext(S, D);
+ if (getLangOpts().HLSL) {
+// exported functions cannot be in an unnamed namespace
+for (const DeclContext *DC = CurContext;
@@ -924,6 +939,23 @@ static bool checkExportedDeclContext(Sema &S, DeclContext
*DC,
/// Check that it's valid to export \p D.
static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) {
+ // HLSL: export declaration is valid only on functions
+ if (S.getLan
@@ -924,6 +939,23 @@ static bool checkExportedDeclContext(Sema &S, DeclContext
*DC,
/// Check that it's valid to export \p D.
static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) {
+ // HLSL: export declaration is valid only on functions
+ if (S.getLan
@@ -851,6 +851,21 @@ Decl *Sema::ActOnStartExportDecl(Scope *S, SourceLocation
ExportLoc,
CurContext->addDecl(D);
PushDeclContext(S, D);
+ if (getLangOpts().HLSL) {
+// exported functions cannot be in an unnamed namespace
+for (const DeclContext *DC = CurContext;
llvm-beanz wrote:
> The grammer looks exactly the same with modules. May it be compatible with
> modules?
The grammar is the same (although HLSL only supports the `export` keyword in a
subset of the places C++ does), but the behavior isn't the same. We may look to
shift HLSL's behavior to mat
ChuanqiXu9 wrote:
The grammer looks exactly the same with modules. May it be compatible with
modules?
https://github.com/llvm/llvm-project/pull/96823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listin
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/96823
>From b67ecd20cc2c11f4f99c2d90c95fdbd988659947 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Wed, 26 Jun 2024 12:31:39 -0700
Subject: [PATCH 1/2] [HLSL] Implement `export` keyword
Fixes #92812
---
.../clang/
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Helena Kotas (hekota)
Changes
Implements `export` keyword in HLSL.
There are two ways the `export` keyword can be used:
1. On individual function declarations
```
export void f() {}
```
2. On a group of function declaration:
```
export {
https://github.com/hekota created
https://github.com/llvm/llvm-project/pull/96823
Implements `export` keyword in HLSL.
There are two ways the `export` keyword can be used:
1. On individual function declarations
```
export void f() {}
```
2. On a group of function declaration:
```
export {
vo
17 matches
Mail list logo