[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-07-01 Thread Helena Kotas via cfe-commits
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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-07-01 Thread Helena Kotas via 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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-07-01 Thread Damyan Pepper via 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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-07-01 Thread Damyan Pepper via cfe-commits
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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-07-01 Thread Damyan Pepper via 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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Justin Bogner via 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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Helena Kotas via 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/

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Helena Kotas via cfe-commits
@@ -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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Helena Kotas via cfe-commits
@@ -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;

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Justin Bogner via cfe-commits
@@ -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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Justin Bogner via cfe-commits
@@ -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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Justin Bogner via cfe-commits
@@ -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;

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Chris B via cfe-commits
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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-26 Thread Chuanqi Xu via cfe-commits
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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-26 Thread Helena Kotas via 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/2] [HLSL] Implement `export` keyword Fixes #92812 --- .../clang/

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-26 Thread via cfe-commits
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 {

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-26 Thread Helena Kotas via cfe-commits
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