microsoft / hlsl-specs

HLSL Specifications
MIT License
116 stars 29 forks source link

Add `export` keyword to HLSL language spec #268

Closed hekota closed 2 months ago

hekota commented 2 months ago

Add export keyword to HLSL language specs.

The spec describes two ways the export keyword can be used.

  1. On individual function declarations
    export void f() {}
  2. On a group of function declaration:
    export {
    void f1();
    void f2() {}
    }

DXC currently supports only the first case, but since Clang has support for both, we might as well support it in HLSL 202y too.

This spec update does not yet include detailed rules for when a function can or cannot be exported, such as when it has resource argument or semantic annotations. That will be covered by llvm/llvm-project#93330.

This change also adds more sections under Declarations (based on C++ spec layout).

Contributes to: llvm/llvm-project#92812

hekota commented 2 months ago

image image

bob80905 commented 2 months ago

For completion, do you also want to define function-declaration ? It doesn't have a grammar definition.

hekota commented 2 months ago

For completion, do you also want to define function-declaration ? It doesn't have a grammar definition.

I believe that is beyond the scope of the task llvm/llvm-project#92812.