brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 95c917a Raw
62 lines · plain
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify2 3// expected-note@+1 {{declared here}}4cbuffer a {5  int x;6};7 8int foo() {9  // expected-error@+1 {{'a' does not refer to a value}}10  return sizeof(a);11}12 13// expected-error@+1 {{expected unqualified-id}}14template <typename Ty> cbuffer a { Ty f; };15 16// For back-compat reason, it is OK for multiple cbuffer/tbuffer use same name in hlsl.17// And these cbuffer name only used for reflection, cannot be removed.18cbuffer A {19  float A;20}21 22cbuffer A {23  float b;24}25 26tbuffer A {27  float a;28}29 30float bar() {31  // cbuffer/tbuffer name will not conflict with other variables.32  return A;33}34 35cbuffer a {36  // expected-error@+2 {{unknown type name 'oh'}}37  // expected-error@+1 {{expected ';' after top level declarator}}38  oh no!39  // expected-warning@+1 {{missing terminating ' character}}40  this isn't even valid HLSL code41  despite seeming totally reasonable42  once you understand that HLSL43  is so flaming weird.44}45 46tbuffer B {47  // expected-error@+1 {{unknown type name 'flaot'}}48  flaot f;49}50 51// None of these should produce an error!52cbuffer EmptyCBuffer {}53 54cbuffer EmptyDeclCBuffer {55  ;56}57 58cbuffer EmptyDecl2CBuffer {59  ;60  int X;61}62