mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 08:36:07 +00:00

This change implements parsing for HLSL's parameter modifier keywords `in`, `out` and `inout`. Because HLSL doesn't support references or pointers, these keywords are used to allow parameters to be passed in and out of functions. This change only implements the parsing and AST support. In the HLSL ASTs we represent `out` and `inout` parameters as references, and we implement the semantics of by-value passing during IR generation. In HLSL parameters marked `out` and `inout` are ambiguous in function declarations, and `in`, `out` and `inout` may be ambiguous at call sites. This means a function may be defined as `fn(in T)` and `fn(inout T)` or `fn(out T)`, but not `fn(inout T)` and `fn(out T)`. If a funciton `fn` is declared with `in` and `inout` or `out` arguments, the call will be ambiguous the same as a C++ call would be ambiguous given declarations `fn(T)` and `fn(T&)`. Fixes #59849
13 lines
494 B
C++
13 lines
494 B
C++
// RUN: %clang_cc1 %s -verify
|
|
extern groupshared float f; // expected-error{{unknown type name 'groupshared'}}
|
|
|
|
extern float groupshared f2; // expected-error{{expected ';' after top level declarator}}
|
|
|
|
namespace {
|
|
float groupshared [[]] f3 = 12; // expected-error{{expected ';' after top level declarator}}
|
|
}
|
|
|
|
// expected-error@#fgc{{expected ';' after top level declarator}}
|
|
// expected-error@#fgc{{a type specifier is required for all declarations}}
|
|
float groupshared const f4 = 12; // #fgc
|