360 changes: 180 additions & 180 deletions clang/test/SemaHLSL/Availability/avail-diag-default-lib.hlsl

Large diffs are not rendered by default.

238 changes: 119 additions & 119 deletions clang/test/SemaHLSL/Availability/avail-diag-relaxed-compute.hlsl
Original file line number Diff line number Diff line change
@@ -1,119 +1,119 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute \
// RUN: -fsyntax-only -Wno-error=hlsl-availability -verify %s

__attribute__((availability(shadermodel, introduced = 6.5)))
float fx(float); // #fx

__attribute__((availability(shadermodel, introduced = 6.6)))
half fx(half); // #fx_half

__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.5, environment = compute)))
float fy(float); // #fy

__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.5, environment = mesh)))
float fz(float); // #fz

float also_alive(float f) {
// expected-warning@#also_alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #also_alive_fx_call
// expected-warning@#also_alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #also_alive_fy_call
// expected-warning@#also_alive_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #also_alive_fz_call
return 0;
}

float alive(float f) {
// expected-warning@#alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #alive_fx_call
// expected-warning@#alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #alive_fy_call
// expected-warning@#alive_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #alive_fz_call

return also_alive(f);
}

float also_dead(float f) {
// unreachable code - no errors expected
float A = fx(f);
float B = fy(f);
float C = fz(f);
return 0;
}

float dead(float f) {
// unreachable code - no errors expected
float A = fx(f);
float B = fy(f);
float C = fz(f);

return also_dead(f);
}

template<typename T>
T aliveTemp(T f) {
// expected-warning@#aliveTemp_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #aliveTemp_fx_call
// expected-warning@#aliveTemp_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #aliveTemp_fy_call
// expected-warning@#aliveTemp_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #aliveTemp_fz_call
return 0;
}

template<typename T> T aliveTemp2(T f) {
// expected-warning@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.6 or newer}}
// expected-note@#fx_half {{'fx' has been marked as being introduced in Shader Model 6.6 here, but the deployment target is Shader Model 6.0}}
// expected-warning@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
return fx(f); // #aliveTemp2_fx_call
}

half test(half x) {
return aliveTemp2(x);
}

float test(float x) {
return aliveTemp2(x);
}

class MyClass
{
float F;
float makeF() {
// expected-warning@#MyClass_makeF_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(F); // #MyClass_makeF_fx_call
// expected-warning@#MyClass_makeF_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(F); // #MyClass_makeF_fy_call
// expected-warning@#MyClass_makeF_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(F); // #MyClass_makeF_fz_call
return 0;
}
};

[numthreads(4,1,1)]
float main() {
float f = 3;
MyClass C = { 1.0f };
float a = alive(f);
float b = aliveTemp<float>(f); // #aliveTemp_inst
float c = C.makeF();
float d = test((float)1.0);
float e = test((half)1.0);
return a * b * c;
}
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute \
// RUN: -fsyntax-only -Wno-error=hlsl-availability -verify %s

__attribute__((availability(shadermodel, introduced = 6.5)))
float fx(float); // #fx

__attribute__((availability(shadermodel, introduced = 6.6)))
half fx(half); // #fx_half

__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.5, environment = compute)))
float fy(float); // #fy

__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.5, environment = mesh)))
float fz(float); // #fz

float also_alive(float f) {
// expected-warning@#also_alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #also_alive_fx_call
// expected-warning@#also_alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #also_alive_fy_call
// expected-warning@#also_alive_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #also_alive_fz_call
return 0;
}

float alive(float f) {
// expected-warning@#alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #alive_fx_call
// expected-warning@#alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #alive_fy_call
// expected-warning@#alive_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #alive_fz_call

return also_alive(f);
}

float also_dead(float f) {
// unreachable code - no errors expected
float A = fx(f);
float B = fy(f);
float C = fz(f);
return 0;
}

float dead(float f) {
// unreachable code - no errors expected
float A = fx(f);
float B = fy(f);
float C = fz(f);

return also_dead(f);
}

template<typename T>
T aliveTemp(T f) {
// expected-warning@#aliveTemp_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #aliveTemp_fx_call
// expected-warning@#aliveTemp_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #aliveTemp_fy_call
// expected-warning@#aliveTemp_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #aliveTemp_fz_call
return 0;
}

template<typename T> T aliveTemp2(T f) {
// expected-warning@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.6 or newer}}
// expected-note@#fx_half {{'fx' has been marked as being introduced in Shader Model 6.6 here, but the deployment target is Shader Model 6.0}}
// expected-warning@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
return fx(f); // #aliveTemp2_fx_call
}

half test(half x) {
return aliveTemp2(x);
}

float test(float x) {
return aliveTemp2(x);
}

class MyClass
{
float F;
float makeF() {
// expected-warning@#MyClass_makeF_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(F); // #MyClass_makeF_fx_call
// expected-warning@#MyClass_makeF_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(F); // #MyClass_makeF_fy_call
// expected-warning@#MyClass_makeF_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(F); // #MyClass_makeF_fz_call
return 0;
}
};

[numthreads(4,1,1)]
float main() {
float f = 3;
MyClass C = { 1.0f };
float a = alive(f);
float b = aliveTemp<float>(f); // #aliveTemp_inst
float c = C.makeF();
float d = test((float)1.0);
float e = test((half)1.0);
return a * b * c;
}
324 changes: 162 additions & 162 deletions clang/test/SemaHLSL/Availability/avail-diag-relaxed-lib.hlsl

Large diffs are not rendered by default.

256 changes: 128 additions & 128 deletions clang/test/SemaHLSL/Availability/avail-diag-strict-compute.hlsl
Original file line number Diff line number Diff line change
@@ -1,129 +1,129 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute \
// RUN: -fhlsl-strict-availability -fsyntax-only -verify %s

__attribute__((availability(shadermodel, introduced = 6.5)))
float fx(float); // #fx

__attribute__((availability(shadermodel, introduced = 6.6)))
half fx(half); // #fx_half

__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.5, environment = compute)))
float fy(float); // #fy

__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.5, environment = mesh)))
float fz(float); // #fz

float also_alive(float f) {
// expected-error@#also_alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #also_alive_fx_call
// expected-error@#also_alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #also_alive_fy_call
// expected-error@#also_alive_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #also_alive_fz_call
return 0;
}

float alive(float f) {
// expected-error@#alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #alive_fx_call
// expected-error@#alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #alive_fy_call
// expected-error@#alive_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #alive_fz_call

return also_alive(f);
}

float also_dead(float f) {
// expected-error@#also_dead_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #also_dead_fx_call
// expected-error@#also_dead_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #also_dead_fy_call
// expected-error@#also_dead_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #also_dead_fz_call
return 0;
}

float dead(float f) {
// expected-error@#dead_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #dead_fx_call
// expected-error@#dead_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #dead_fy_call
// expected-error@#dead_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #dead_fz_call

return also_dead(f);
}

template<typename T>
T aliveTemp(T f) {
// expected-error@#aliveTemp_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#aliveTemp_inst {{in instantiation of function template specialization 'aliveTemp<float>' requested here}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #aliveTemp_fx_call
// expected-error@#aliveTemp_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #aliveTemp_fy_call
// expected-error@#aliveTemp_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #aliveTemp_fz_call
return 0;
}

template<typename T> T aliveTemp2(T f) {
// expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.6 or newer}}
// expected-note@#fx_half {{'fx' has been marked as being introduced in Shader Model 6.6 here, but the deployment target is Shader Model 6.0}}
// expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
return fx(f); // #aliveTemp2_fx_call
}

half test(half x) {
return aliveTemp2(x); // expected-note {{in instantiation of function template specialization 'aliveTemp2<half>' requested here}}
}

float test(float x) {
return aliveTemp2(x); // expected-note {{in instantiation of function template specialization 'aliveTemp2<float>' requested here}}
}

class MyClass
{
float F;
float makeF() {
// expected-error@#MyClass_makeF_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(F); // #MyClass_makeF_fx_call
// expected-error@#MyClass_makeF_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(F); // #MyClass_makeF_fy_call
// expected-error@#MyClass_makeF_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(F); // #MyClass_makeF_fz_call
}
};

[numthreads(4,1,1)]
float main() {
float f = 3;
MyClass C = { 1.0f };
float a = alive(f);
float b = aliveTemp<float>(f); // #aliveTemp_inst
float c = C.makeF();
float d = test((float)1.0);
float e = test((half)1.0);
return a * b * c;
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute \
// RUN: -fhlsl-strict-availability -fsyntax-only -verify %s

__attribute__((availability(shadermodel, introduced = 6.5)))
float fx(float); // #fx

__attribute__((availability(shadermodel, introduced = 6.6)))
half fx(half); // #fx_half

__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.5, environment = compute)))
float fy(float); // #fy

__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.5, environment = mesh)))
float fz(float); // #fz

float also_alive(float f) {
// expected-error@#also_alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #also_alive_fx_call
// expected-error@#also_alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #also_alive_fy_call
// expected-error@#also_alive_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #also_alive_fz_call
return 0;
}

float alive(float f) {
// expected-error@#alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #alive_fx_call
// expected-error@#alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #alive_fy_call
// expected-error@#alive_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #alive_fz_call

return also_alive(f);
}

float also_dead(float f) {
// expected-error@#also_dead_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #also_dead_fx_call
// expected-error@#also_dead_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #also_dead_fy_call
// expected-error@#also_dead_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #also_dead_fz_call
return 0;
}

float dead(float f) {
// expected-error@#dead_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #dead_fx_call
// expected-error@#dead_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #dead_fy_call
// expected-error@#dead_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #dead_fz_call

return also_dead(f);
}

template<typename T>
T aliveTemp(T f) {
// expected-error@#aliveTemp_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#aliveTemp_inst {{in instantiation of function template specialization 'aliveTemp<float>' requested here}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #aliveTemp_fx_call
// expected-error@#aliveTemp_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #aliveTemp_fy_call
// expected-error@#aliveTemp_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(f); // #aliveTemp_fz_call
return 0;
}

template<typename T> T aliveTemp2(T f) {
// expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.6 or newer}}
// expected-note@#fx_half {{'fx' has been marked as being introduced in Shader Model 6.6 here, but the deployment target is Shader Model 6.0}}
// expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
return fx(f); // #aliveTemp2_fx_call
}

half test(half x) {
return aliveTemp2(x); // expected-note {{in instantiation of function template specialization 'aliveTemp2<half>' requested here}}
}

float test(float x) {
return aliveTemp2(x); // expected-note {{in instantiation of function template specialization 'aliveTemp2<float>' requested here}}
}

class MyClass
{
float F;
float makeF() {
// expected-error@#MyClass_makeF_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(F); // #MyClass_makeF_fx_call
// expected-error@#MyClass_makeF_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(F); // #MyClass_makeF_fy_call
// expected-error@#MyClass_makeF_fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
float C = fz(F); // #MyClass_makeF_fz_call
}
};

[numthreads(4,1,1)]
float main() {
float f = 3;
MyClass C = { 1.0f };
float a = alive(f);
float b = aliveTemp<float>(f); // #aliveTemp_inst
float c = C.makeF();
float d = test((float)1.0);
float e = test((half)1.0);
return a * b * c;
}
384 changes: 192 additions & 192 deletions clang/test/SemaHLSL/Availability/avail-diag-strict-lib.hlsl

Large diffs are not rendered by default.

114 changes: 57 additions & 57 deletions clang/test/SemaHLSL/Availability/avail-lib-multiple-stages.hlsl
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library \
// RUN: -fsyntax-only -verify %s

__attribute__((availability(shadermodel, introduced = 6.5)))
float fx(float); // #fx

__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.5, environment = compute)))
float fy(float); // #fy

__attribute__((availability(shadermodel, introduced = 5.0, environment = compute)))
float fz(float); // #fz


void F(float f) {
// Make sure we only get this error once, even though this function is scanned twice - once
// in compute shader context and once in pixel shader context.
// expected-error@#fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #fx_call

// expected-error@#fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #fy_call

// expected-error@#fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 5.0 in compute environment here, but the deployment target is Shader Model 6.0 pixel environment}}
float X = fz(f); // #fz_call
}

void deadCode(float f) {
// no diagnostics expected under default diagnostic mode
float A = fx(f);
float B = fy(f);
float X = fz(f);
}

// Pixel shader
[shader("pixel")]
void mainPixel() {
F(1.0);
}

// First Compute shader
[shader("compute")]
[numthreads(4,1,1)]
void mainCompute1() {
F(2.0);
}

// Second compute shader to make sure we do not get duplicate messages if F is called
// from multiple entry points.
[shader("compute")]
[numthreads(4,1,1)]
void mainCompute2() {
F(3.0);
}
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library \
// RUN: -fsyntax-only -verify %s

__attribute__((availability(shadermodel, introduced = 6.5)))
float fx(float); // #fx

__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.5, environment = compute)))
float fy(float); // #fy

__attribute__((availability(shadermodel, introduced = 5.0, environment = compute)))
float fz(float); // #fz


void F(float f) {
// Make sure we only get this error once, even though this function is scanned twice - once
// in compute shader context and once in pixel shader context.
// expected-error@#fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #fx_call

// expected-error@#fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
float B = fy(f); // #fy_call

// expected-error@#fz_call {{'fz' is unavailable}}
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 5.0 in compute environment here, but the deployment target is Shader Model 6.0 pixel environment}}
float X = fz(f); // #fz_call
}

void deadCode(float f) {
// no diagnostics expected under default diagnostic mode
float A = fx(f);
float B = fy(f);
float X = fz(f);
}

// Pixel shader
[shader("pixel")]
void mainPixel() {
F(1.0);
}

// First Compute shader
[shader("compute")]
[numthreads(4,1,1)]
void mainCompute1() {
F(2.0);
}

// Second compute shader to make sure we do not get duplicate messages if F is called
// from multiple entry points.
[shader("compute")]
[numthreads(4,1,1)]
void mainCompute2() {
F(3.0);
}
38 changes: 19 additions & 19 deletions clang/test/SemaHLSL/BuiltIns/StructuredBuffers.hlsl
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -fsyntax-only -verify %s

typedef vector<float, 3> float3;

StructuredBuffer<float3> Buffer;

// expected-error@+2 {{class template 'StructuredBuffer' requires template arguments}}
// expected-note@*:* {{template declaration from hidden source: template <class element_type> class StructuredBuffer}}
StructuredBuffer BufferErr1;

// expected-error@+2 {{too few template arguments for class template 'StructuredBuffer'}}
// expected-note@*:* {{template declaration from hidden source: template <class element_type> class StructuredBuffer}}
StructuredBuffer<> BufferErr2;

[numthreads(1,1,1)]
void main() {
(void)Buffer.h; // expected-error {{'h' is a private member of 'hlsl::StructuredBuffer<vector<float, 3>>'}}
// expected-note@* {{implicitly declared private here}}
}
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -fsyntax-only -verify %s

typedef vector<float, 3> float3;

StructuredBuffer<float3> Buffer;

// expected-error@+2 {{class template 'StructuredBuffer' requires template arguments}}
// expected-note@*:* {{template declaration from hidden source: template <class element_type> class StructuredBuffer}}
StructuredBuffer BufferErr1;

// expected-error@+2 {{too few template arguments for class template 'StructuredBuffer'}}
// expected-note@*:* {{template declaration from hidden source: template <class element_type> class StructuredBuffer}}
StructuredBuffer<> BufferErr2;

[numthreads(1,1,1)]
void main() {
(void)Buffer.h; // expected-error {{'h' is a private member of 'hlsl::StructuredBuffer<vector<float, 3>>'}}
// expected-note@* {{implicitly declared private here}}
}
86 changes: 43 additions & 43 deletions clang/test/SemaHLSL/BuiltIns/cross-errors.hlsl
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify

void test_too_few_arg()
{
return __builtin_hlsl_cross();
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
}

void test_too_many_arg(float3 p0)
{
return __builtin_hlsl_cross(p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
}

bool builtin_bool_to_float_type_promotion(bool p1)
{
return __builtin_hlsl_cross(p1, p1);
// expected-error@-1 {{passing 'bool' to parameter of incompatible type 'float'}}
}

bool builtin_cross_int_to_float_promotion(int p1)
{
return __builtin_hlsl_cross(p1, p1);
// expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}}
}

bool2 builtin_cross_int2_to_float2_promotion(int2 p1)
{
return __builtin_hlsl_cross(p1, p1);
// expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}

float2 builtin_cross_float2(float2 p1, float2 p2)
{
return __builtin_hlsl_cross(p1, p2);
// expected-error@-1 {{too many elements in vector operand (expected 3 elements, have 2)}}
}

float3 builtin_cross_float3_int3(float3 p1, int3 p2)
{
return __builtin_hlsl_cross(p1, p2);
// expected-error@-1 {{all arguments to '__builtin_hlsl_cross' must have the same type}}
}
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify

void test_too_few_arg()
{
return __builtin_hlsl_cross();
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
}

void test_too_many_arg(float3 p0)
{
return __builtin_hlsl_cross(p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
}

bool builtin_bool_to_float_type_promotion(bool p1)
{
return __builtin_hlsl_cross(p1, p1);
// expected-error@-1 {{passing 'bool' to parameter of incompatible type 'float'}}
}

bool builtin_cross_int_to_float_promotion(int p1)
{
return __builtin_hlsl_cross(p1, p1);
// expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}}
}

bool2 builtin_cross_int2_to_float2_promotion(int2 p1)
{
return __builtin_hlsl_cross(p1, p1);
// expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}

float2 builtin_cross_float2(float2 p1, float2 p2)
{
return __builtin_hlsl_cross(p1, p2);
// expected-error@-1 {{too many elements in vector operand (expected 3 elements, have 2)}}
}

float3 builtin_cross_float3_int3(float3 p1, int3 p2)
{
return __builtin_hlsl_cross(p1, p2);
// expected-error@-1 {{all arguments to '__builtin_hlsl_cross' must have the same type}}
}
26 changes: 13 additions & 13 deletions clang/test/SemaHLSL/BuiltIns/half-float-only-errors2.hlsl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_atan2
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_fmod
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_pow

double test_double_builtin(double p0, double p1) {
return TEST_FUNC(p0, p1);
// expected-error@-1 {{passing 'double' to parameter of incompatible type 'float'}}
}

double2 test_vec_double_builtin(double2 p0, double2 p1) {
return TEST_FUNC(p0, p1);
// expected-error@-1 {{passing 'double2' (aka 'vector<double, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_atan2
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_fmod
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_pow

double test_double_builtin(double p0, double p1) {
return TEST_FUNC(p0, p1);
// expected-error@-1 {{passing 'double' to parameter of incompatible type 'float'}}
}

double2 test_vec_double_builtin(double2 p0, double2 p1) {
return TEST_FUNC(p0, p1);
// expected-error@-1 {{passing 'double2' (aka 'vector<double, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}
64 changes: 32 additions & 32 deletions clang/test/SemaHLSL/BuiltIns/length-errors.hlsl
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected


void test_too_few_arg()
{
return __builtin_hlsl_length();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
}

void test_too_many_arg(float2 p0)
{
return __builtin_hlsl_length(p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
}

bool builtin_bool_to_float_type_promotion(bool p1)
{
return __builtin_hlsl_length(p1);
// expected-error@-1 {passing 'bool' to parameter of incompatible type 'float'}}
}

bool builtin_length_int_to_float_promotion(int p1)
{
return __builtin_hlsl_length(p1);
// expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}}
}

bool2 builtin_length_int2_to_float2_promotion(int2 p1)
{
return __builtin_hlsl_length(p1);
// expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected


void test_too_few_arg()
{
return __builtin_hlsl_length();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
}

void test_too_many_arg(float2 p0)
{
return __builtin_hlsl_length(p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
}

bool builtin_bool_to_float_type_promotion(bool p1)
{
return __builtin_hlsl_length(p1);
// expected-error@-1 {passing 'bool' to parameter of incompatible type 'float'}}
}

bool builtin_length_int_to_float_promotion(int p1)
{
return __builtin_hlsl_length(p1);
// expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}}
}

bool2 builtin_length_int2_to_float2_promotion(int2 p1)
{
return __builtin_hlsl_length(p1);
// expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}
62 changes: 31 additions & 31 deletions clang/test/SemaHLSL/BuiltIns/normalize-errors.hlsl
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected

void test_too_few_arg()
{
return __builtin_hlsl_normalize();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
}

void test_too_many_arg(float2 p0)
{
return __builtin_hlsl_normalize(p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
}

bool builtin_bool_to_float_type_promotion(bool p1)
{
return __builtin_hlsl_normalize(p1);
// expected-error@-1 {passing 'bool' to parameter of incompatible type 'float'}}
}

bool builtin_normalize_int_to_float_promotion(int p1)
{
return __builtin_hlsl_normalize(p1);
// expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}}
}

bool2 builtin_normalize_int2_to_float2_promotion(int2 p1)
{
return __builtin_hlsl_normalize(p1);
// expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected

void test_too_few_arg()
{
return __builtin_hlsl_normalize();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
}

void test_too_many_arg(float2 p0)
{
return __builtin_hlsl_normalize(p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
}

bool builtin_bool_to_float_type_promotion(bool p1)
{
return __builtin_hlsl_normalize(p1);
// expected-error@-1 {passing 'bool' to parameter of incompatible type 'float'}}
}

bool builtin_normalize_int_to_float_promotion(int p1)
{
return __builtin_hlsl_normalize(p1);
// expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}}
}

bool2 builtin_normalize_int2_to_float2_promotion(int2 p1)
{
return __builtin_hlsl_normalize(p1);
// expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}
62 changes: 31 additions & 31 deletions clang/test/SemaHLSL/BuiltIns/step-errors.hlsl
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected

void test_too_few_arg()
{
return __builtin_hlsl_step();
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
}

void test_too_many_arg(float2 p0)
{
return __builtin_hlsl_step(p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
}

bool builtin_bool_to_float_type_promotion(bool p1)
{
return __builtin_hlsl_step(p1, p1);
// expected-error@-1 {passing 'bool' to parameter of incompatible type 'float'}}
}

bool builtin_step_int_to_float_promotion(int p1)
{
return __builtin_hlsl_step(p1, p1);
// expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}}
}

bool2 builtin_step_int2_to_float2_promotion(int2 p1)
{
return __builtin_hlsl_step(p1, p1);
// expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected

void test_too_few_arg()
{
return __builtin_hlsl_step();
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
}

void test_too_many_arg(float2 p0)
{
return __builtin_hlsl_step(p0, p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
}

bool builtin_bool_to_float_type_promotion(bool p1)
{
return __builtin_hlsl_step(p1, p1);
// expected-error@-1 {passing 'bool' to parameter of incompatible type 'float'}}
}

bool builtin_step_int_to_float_promotion(int p1)
{
return __builtin_hlsl_step(p1, p1);
// expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}}
}

bool2 builtin_step_int2_to_float2_promotion(int2 p1)
{
return __builtin_hlsl_step(p1, p1);
// expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
}
162 changes: 81 additions & 81 deletions clang/test/SemaHLSL/Types/Traits/IsIntangibleType.hlsl
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -verify %s
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s
// expected-no-diagnostics

_Static_assert(__builtin_hlsl_is_intangible(__hlsl_resource_t), "");
// no need to check array of __hlsl_resource_t, arrays of sizeless types are not supported

_Static_assert(!__builtin_hlsl_is_intangible(int), "");
_Static_assert(!__builtin_hlsl_is_intangible(float3), "");
_Static_assert(!__builtin_hlsl_is_intangible(half[4]), "");

typedef __hlsl_resource_t Res;
_Static_assert(__builtin_hlsl_is_intangible(const Res), "");
// no need to check array of Res, arrays of sizeless types are not supported

struct ABuffer {
const int i[10];
__hlsl_resource_t h;
};
_Static_assert(__builtin_hlsl_is_intangible(ABuffer), "");
_Static_assert(__builtin_hlsl_is_intangible(ABuffer[10]), "");

struct MyStruct {
half2 h2;
int3 i3;
};
_Static_assert(!__builtin_hlsl_is_intangible(MyStruct), "");
_Static_assert(!__builtin_hlsl_is_intangible(MyStruct[10]), "");

class MyClass {
int3 ivec;
float farray[12];
MyStruct ms;
ABuffer buf;
};
_Static_assert(__builtin_hlsl_is_intangible(MyClass), "");
_Static_assert(__builtin_hlsl_is_intangible(MyClass[2]), "");

union U {
double d[4];
Res buf;
};
_Static_assert(__builtin_hlsl_is_intangible(U), "");
_Static_assert(__builtin_hlsl_is_intangible(U[100]), "");

class MyClass2 {
int3 ivec;
float farray[12];
U u;
};
_Static_assert(__builtin_hlsl_is_intangible(MyClass2), "");
_Static_assert(__builtin_hlsl_is_intangible(MyClass2[5]), "");

class Simple {
int a;
};

template<typename T> struct TemplatedBuffer {
T a;
__hlsl_resource_t h;
};
_Static_assert(__builtin_hlsl_is_intangible(TemplatedBuffer<int>), "");

struct MyStruct2 : TemplatedBuffer<float> {
float x;
};
_Static_assert(__builtin_hlsl_is_intangible(MyStruct2), "");

struct MyStruct3 {
const TemplatedBuffer<float> TB[10];
};
_Static_assert(__builtin_hlsl_is_intangible(MyStruct3), "");

template<typename T> struct SimpleTemplate {
T a;
};
_Static_assert(__builtin_hlsl_is_intangible(SimpleTemplate<__hlsl_resource_t>), "");
_Static_assert(!__builtin_hlsl_is_intangible(SimpleTemplate<float>), "");

_Static_assert(__builtin_hlsl_is_intangible(RWBuffer<float>), "");
_Static_assert(__builtin_hlsl_is_intangible(StructuredBuffer<Simple>), "");
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -verify %s
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s
// expected-no-diagnostics

_Static_assert(__builtin_hlsl_is_intangible(__hlsl_resource_t), "");
// no need to check array of __hlsl_resource_t, arrays of sizeless types are not supported

_Static_assert(!__builtin_hlsl_is_intangible(int), "");
_Static_assert(!__builtin_hlsl_is_intangible(float3), "");
_Static_assert(!__builtin_hlsl_is_intangible(half[4]), "");

typedef __hlsl_resource_t Res;
_Static_assert(__builtin_hlsl_is_intangible(const Res), "");
// no need to check array of Res, arrays of sizeless types are not supported

struct ABuffer {
const int i[10];
__hlsl_resource_t h;
};
_Static_assert(__builtin_hlsl_is_intangible(ABuffer), "");
_Static_assert(__builtin_hlsl_is_intangible(ABuffer[10]), "");

struct MyStruct {
half2 h2;
int3 i3;
};
_Static_assert(!__builtin_hlsl_is_intangible(MyStruct), "");
_Static_assert(!__builtin_hlsl_is_intangible(MyStruct[10]), "");

class MyClass {
int3 ivec;
float farray[12];
MyStruct ms;
ABuffer buf;
};
_Static_assert(__builtin_hlsl_is_intangible(MyClass), "");
_Static_assert(__builtin_hlsl_is_intangible(MyClass[2]), "");

union U {
double d[4];
Res buf;
};
_Static_assert(__builtin_hlsl_is_intangible(U), "");
_Static_assert(__builtin_hlsl_is_intangible(U[100]), "");

class MyClass2 {
int3 ivec;
float farray[12];
U u;
};
_Static_assert(__builtin_hlsl_is_intangible(MyClass2), "");
_Static_assert(__builtin_hlsl_is_intangible(MyClass2[5]), "");

class Simple {
int a;
};

template<typename T> struct TemplatedBuffer {
T a;
__hlsl_resource_t h;
};
_Static_assert(__builtin_hlsl_is_intangible(TemplatedBuffer<int>), "");

struct MyStruct2 : TemplatedBuffer<float> {
float x;
};
_Static_assert(__builtin_hlsl_is_intangible(MyStruct2), "");

struct MyStruct3 {
const TemplatedBuffer<float> TB[10];
};
_Static_assert(__builtin_hlsl_is_intangible(MyStruct3), "");

template<typename T> struct SimpleTemplate {
T a;
};
_Static_assert(__builtin_hlsl_is_intangible(SimpleTemplate<__hlsl_resource_t>), "");
_Static_assert(!__builtin_hlsl_is_intangible(SimpleTemplate<float>), "");

_Static_assert(__builtin_hlsl_is_intangible(RWBuffer<float>), "");
_Static_assert(__builtin_hlsl_is_intangible(StructuredBuffer<Simple>), "");
24 changes: 12 additions & 12 deletions clang/test/SemaHLSL/Types/Traits/IsIntangibleTypeErrors.hlsl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -verify %s

struct Undefined; // expected-note {{forward declaration of 'Undefined'}}
_Static_assert(!__builtin_hlsl_is_intangible(Undefined), ""); // expected-error{{incomplete type 'Undefined' used in type trait expression}}

void fn(int X) { // expected-note {{declared here}}
// expected-error@#vla {{variable length arrays are not supported for the current target}}
// expected-error@#vla {{variable length arrays are not supported in '__builtin_hlsl_is_intangible'}}
// expected-warning@#vla {{variable length arrays in C++ are a Clang extension}}
// expected-note@#vla {{function parameter 'X' with unknown value cannot be used in a constant expression}}
_Static_assert(!__builtin_hlsl_is_intangible(int[X]), ""); // #vla
}
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -verify %s

struct Undefined; // expected-note {{forward declaration of 'Undefined'}}
_Static_assert(!__builtin_hlsl_is_intangible(Undefined), ""); // expected-error{{incomplete type 'Undefined' used in type trait expression}}

void fn(int X) { // expected-note {{declared here}}
// expected-error@#vla {{variable length arrays are not supported for the current target}}
// expected-error@#vla {{variable length arrays are not supported in '__builtin_hlsl_is_intangible'}}
// expected-warning@#vla {{variable length arrays in C++ are a Clang extension}}
// expected-note@#vla {{function parameter 'X' with unknown value cannot be used in a constant expression}}
_Static_assert(!__builtin_hlsl_is_intangible(int[X]), ""); // #vla
}
84 changes: 42 additions & 42 deletions clang/test/SemaHLSL/resource_binding_attr_error_basic.hlsl
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify

// expected-error@+1{{binding type 't' only applies to SRV resources}}
float f1 : register(t0);

// expected-error@+1 {{binding type 'u' only applies to UAV resources}}
float f2 : register(u0);

// expected-error@+1{{binding type 'b' only applies to constant buffers. The 'bool constant' binding type is no longer supported}}
float f3 : register(b9);

// expected-error@+1 {{binding type 's' only applies to sampler state}}
float f4 : register(s0);

// expected-error@+1{{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}
float f5 : register(i9);

// expected-error@+1{{binding type 'x' is invalid}}
float f6 : register(x9);

cbuffer g_cbuffer1 {
// expected-error@+1{{binding type 'c' ignored in buffer declaration. Did you mean 'packoffset'?}}
float f7 : register(c2);
};

tbuffer g_tbuffer1 {
// expected-error@+1{{binding type 'c' ignored in buffer declaration. Did you mean 'packoffset'?}}
float f8 : register(c2);
};

cbuffer g_cbuffer2 {
// expected-error@+1{{binding type 'b' only applies to constant buffer resources}}
float f9 : register(b2);
};

tbuffer g_tbuffer2 {
// expected-error@+1{{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}
float f10 : register(i2);
};

// expected-error@+1{{binding type 'c' only applies to numeric variables in the global scope}}
RWBuffer<float> f11 : register(c3);
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify

// expected-error@+1{{binding type 't' only applies to SRV resources}}
float f1 : register(t0);

// expected-error@+1 {{binding type 'u' only applies to UAV resources}}
float f2 : register(u0);

// expected-error@+1{{binding type 'b' only applies to constant buffers. The 'bool constant' binding type is no longer supported}}
float f3 : register(b9);

// expected-error@+1 {{binding type 's' only applies to sampler state}}
float f4 : register(s0);

// expected-error@+1{{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}
float f5 : register(i9);

// expected-error@+1{{binding type 'x' is invalid}}
float f6 : register(x9);

cbuffer g_cbuffer1 {
// expected-error@+1{{binding type 'c' ignored in buffer declaration. Did you mean 'packoffset'?}}
float f7 : register(c2);
};

tbuffer g_tbuffer1 {
// expected-error@+1{{binding type 'c' ignored in buffer declaration. Did you mean 'packoffset'?}}
float f8 : register(c2);
};

cbuffer g_cbuffer2 {
// expected-error@+1{{binding type 'b' only applies to constant buffer resources}}
float f9 : register(b2);
};

tbuffer g_tbuffer2 {
// expected-error@+1{{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}
float f10 : register(i2);
};

// expected-error@+1{{binding type 'c' only applies to numeric variables in the global scope}}
RWBuffer<float> f11 : register(c3);
18 changes: 9 additions & 9 deletions clang/test/SemaHLSL/resource_binding_attr_error_other.hlsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// RUN: not %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s | FileCheck %s

// XFAIL: *
// This expectedly fails because RayQuery is an unsupported type.
// When it becomes supported, we should expect an error due to
// the variable type being classified as "other", and according
// to the spec, err_hlsl_unsupported_register_type_and_variable_type
// should be emitted.
RayQuery<0> r1: register(t0);
// RUN: not %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s | FileCheck %s

// XFAIL: *
// This expectedly fails because RayQuery is an unsupported type.
// When it becomes supported, we should expect an error due to
// the variable type being classified as "other", and according
// to the spec, err_hlsl_unsupported_register_type_and_variable_type
// should be emitted.
RayQuery<0> r1: register(t0);
98 changes: 49 additions & 49 deletions clang/test/SemaHLSL/resource_binding_attr_error_resource.hlsl
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify

// This test validates the diagnostics that are emitted when a variable with a "resource" type
// is bound to a register using the register annotation


template<typename T>
struct MyTemplatedSRV {
__hlsl_resource_t [[hlsl::resource_class(SRV)]] x;
};

struct MySRV {
__hlsl_resource_t [[hlsl::resource_class(SRV)]] x;
};

struct MySampler {
__hlsl_resource_t [[hlsl::resource_class(Sampler)]] x;
};

struct MyUAV {
__hlsl_resource_t [[hlsl::resource_class(UAV)]] x;
};

struct MyCBuffer {
__hlsl_resource_t [[hlsl::resource_class(CBuffer)]] x;
};


// expected-error@+1 {{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}
MySRV invalid : register(i2);

// expected-error@+1 {{binding type 't' only applies to SRV resources}}
MyUAV a : register(t2, space1);

// expected-error@+1 {{binding type 'u' only applies to UAV resources}}
MySampler b : register(u2, space1);

// expected-error@+1 {{binding type 'b' only applies to constant buffer resources}}
MyTemplatedSRV<int> c : register(b2);

// expected-error@+1 {{binding type 's' only applies to sampler state}}
MyUAV d : register(s2, space1);

// empty binding prefix cases:
// expected-error@+1 {{expected identifier}}
MyTemplatedSRV<int> e: register();

// expected-error@+1 {{expected identifier}}
MyTemplatedSRV<int> f: register("");
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify

// This test validates the diagnostics that are emitted when a variable with a "resource" type
// is bound to a register using the register annotation


template<typename T>
struct MyTemplatedSRV {
__hlsl_resource_t [[hlsl::resource_class(SRV)]] x;
};

struct MySRV {
__hlsl_resource_t [[hlsl::resource_class(SRV)]] x;
};

struct MySampler {
__hlsl_resource_t [[hlsl::resource_class(Sampler)]] x;
};

struct MyUAV {
__hlsl_resource_t [[hlsl::resource_class(UAV)]] x;
};

struct MyCBuffer {
__hlsl_resource_t [[hlsl::resource_class(CBuffer)]] x;
};


// expected-error@+1 {{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}
MySRV invalid : register(i2);

// expected-error@+1 {{binding type 't' only applies to SRV resources}}
MyUAV a : register(t2, space1);

// expected-error@+1 {{binding type 'u' only applies to UAV resources}}
MySampler b : register(u2, space1);

// expected-error@+1 {{binding type 'b' only applies to constant buffer resources}}
MyTemplatedSRV<int> c : register(b2);

// expected-error@+1 {{binding type 's' only applies to sampler state}}
MyUAV d : register(s2, space1);

// empty binding prefix cases:
// expected-error@+1 {{expected identifier}}
MyTemplatedSRV<int> e: register();

// expected-error@+1 {{expected identifier}}
MyTemplatedSRV<int> f: register("");
54 changes: 27 additions & 27 deletions clang/test/SemaHLSL/resource_binding_attr_error_silence_diags.hlsl
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only -Wno-legacy-constant-register-binding %s -verify

// expected-no-diagnostics
float f2 : register(b9);

float f3 : register(i9);

cbuffer g_cbuffer1 {
float f4 : register(c2);
};


struct Eg12{
RWBuffer<int> a;
};

Eg12 e12 : register(c9);

Eg12 bar : register(i1);

struct Eg7 {
struct Bar {
float f;
};
Bar b;
};
Eg7 e7 : register(t0);
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only -Wno-legacy-constant-register-binding %s -verify

// expected-no-diagnostics
float f2 : register(b9);

float f3 : register(i9);

cbuffer g_cbuffer1 {
float f4 : register(c2);
};


struct Eg12{
RWBuffer<int> a;
};

Eg12 e12 : register(c9);

Eg12 bar : register(i1);

struct Eg7 {
struct Bar {
float f;
};
Bar b;
};
Eg7 e7 : register(t0);
124 changes: 62 additions & 62 deletions clang/test/SemaHLSL/resource_binding_attr_error_space.hlsl
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify

// valid
cbuffer cbuf {
RWBuffer<int> r : register(u0, space0);
}

cbuffer cbuf2 {
struct x {
// this test validates that no diagnostic is emitted on the space parameter, because
// this register annotation is not in the global scope.
// expected-error@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}
RWBuffer<int> E : register(u2, space3);
};
}

struct MyStruct {
RWBuffer<int> E;
};

cbuffer cbuf3 {
// valid
MyStruct E : register(u2, space3);
}

// valid
MyStruct F : register(u3, space4);

cbuffer cbuf4 {
// this test validates that no diagnostic is emitted on the space parameter, because
// this register annotation is not in the global scope.
// expected-error@+1 {{binding type 'u' only applies to UAV resources}}
float a : register(u2, space3);
}

// expected-error@+1 {{invalid space specifier 's2' used; expected 'space' followed by an integer, like space1}}
cbuffer a : register(b0, s2) {

}

// expected-error@+1 {{invalid space specifier 'spaces' used; expected 'space' followed by an integer, like space1}}
cbuffer b : register(b2, spaces) {

}

// expected-error@+1 {{wrong argument format for hlsl attribute, use space3 instead}}
cbuffer c : register(b2, space 3) {}

// expected-error@+1 {{register space cannot be specified on global constants}}
int d : register(c2, space3);

// expected-error@+1 {{register space cannot be specified on global constants}}
int e : register(c2, space0);

// expected-error@+1 {{register space cannot be specified on global constants}}
int f : register(c2, space00);

// valid
RWBuffer<int> g : register(u2, space0);

// valid
RWBuffer<int> h : register(u2, space0);
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify

// valid
cbuffer cbuf {
RWBuffer<int> r : register(u0, space0);
}

cbuffer cbuf2 {
struct x {
// this test validates that no diagnostic is emitted on the space parameter, because
// this register annotation is not in the global scope.
// expected-error@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}
RWBuffer<int> E : register(u2, space3);
};
}

struct MyStruct {
RWBuffer<int> E;
};

cbuffer cbuf3 {
// valid
MyStruct E : register(u2, space3);
}

// valid
MyStruct F : register(u3, space4);

cbuffer cbuf4 {
// this test validates that no diagnostic is emitted on the space parameter, because
// this register annotation is not in the global scope.
// expected-error@+1 {{binding type 'u' only applies to UAV resources}}
float a : register(u2, space3);
}

// expected-error@+1 {{invalid space specifier 's2' used; expected 'space' followed by an integer, like space1}}
cbuffer a : register(b0, s2) {

}

// expected-error@+1 {{invalid space specifier 'spaces' used; expected 'space' followed by an integer, like space1}}
cbuffer b : register(b2, spaces) {

}

// expected-error@+1 {{wrong argument format for hlsl attribute, use space3 instead}}
cbuffer c : register(b2, space 3) {}

// expected-error@+1 {{register space cannot be specified on global constants}}
int d : register(c2, space3);

// expected-error@+1 {{register space cannot be specified on global constants}}
int e : register(c2, space0);

// expected-error@+1 {{register space cannot be specified on global constants}}
int f : register(c2, space00);

// valid
RWBuffer<int> g : register(u2, space0);

// valid
RWBuffer<int> h : register(u2, space0);
270 changes: 135 additions & 135 deletions clang/test/SemaHLSL/resource_binding_attr_error_udt.hlsl
Original file line number Diff line number Diff line change
@@ -1,135 +1,135 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify

template<typename T>
struct MyTemplatedUAV {
__hlsl_resource_t [[hlsl::resource_class(UAV)]] x;
};

struct MySRV {
__hlsl_resource_t [[hlsl::resource_class(SRV)]] x;
};

struct MySampler {
__hlsl_resource_t [[hlsl::resource_class(Sampler)]] x;
};

struct MyUAV {
__hlsl_resource_t [[hlsl::resource_class(UAV)]] x;
};

struct MyCBuffer {
__hlsl_resource_t [[hlsl::resource_class(CBuffer)]] x;
};

// Valid: f is skipped, SRVBuf is bound to t0, UAVBuf is bound to u0
struct Eg1 {
float f;
MySRV SRVBuf;
MyUAV UAVBuf;
};
Eg1 e1 : register(t0) : register(u0);

// Valid: f is skipped, SRVBuf is bound to t0, UAVBuf is bound to u0.
// UAVBuf2 gets automatically assigned to u1 even though there is no explicit binding for u1.
struct Eg2 {
float f;
MySRV SRVBuf;
MyUAV UAVBuf;
MyUAV UAVBuf2;
};
Eg2 e2 : register(t0) : register(u0);

// Valid: Bar, the struct within Eg3, has a valid resource that can be bound to t0.
struct Eg3 {
struct Bar {
MyUAV a;
};
Bar b;
};
Eg3 e3 : register(u0);

// Valid: the first sampler state object within 's' is bound to slot 5
struct Eg4 {
MySampler s[3];
};

Eg4 e4 : register(s5);


struct Eg5 {
float f;
};
// expected-warning@+1{{binding type 't' only applies to types containing SRV resources}}
Eg5 e5 : register(t0);

struct Eg6 {
float f;
};
// expected-warning@+1{{binding type 'u' only applies to types containing UAV resources}}
Eg6 e6 : register(u0);

struct Eg7 {
float f;
};
// expected-warning@+1{{binding type 'b' only applies to types containing constant buffer resources}}
Eg7 e7 : register(b0);

struct Eg8 {
float f;
};
// expected-warning@+1{{binding type 's' only applies to types containing sampler state}}
Eg8 e8 : register(s0);

struct Eg9 {
MySRV s;
};
// expected-warning@+1{{binding type 'c' only applies to types containing numeric types}}
Eg9 e9 : register(c0);

struct Eg10{
// expected-error@+1{{'register' attribute only applies to cbuffer/tbuffer and external global variables}}
MyTemplatedUAV<int> a : register(u9);
};
Eg10 e10;


template<typename R>
struct Eg11 {
R b;
};
// expected-warning@+1{{binding type 'u' only applies to types containing UAV resources}}
Eg11<MySRV> e11 : register(u0);
// invalid because after template expansion, there are no valid resources inside Eg11 to bind as a UAV, only an SRV


struct Eg12{
MySRV s1;
MySRV s2;
};
// expected-warning@+2{{binding type 'u' only applies to types containing UAV resources}}
// expected-error@+1{{binding type 'u' cannot be applied more than once}}
Eg12 e12 : register(u9) : register(u10);

struct Eg13{
MySRV s1;
MySRV s2;
};
// expected-warning@+3{{binding type 'u' only applies to types containing UAV resources}}
// expected-error@+2{{binding type 'u' cannot be applied more than once}}
// expected-error@+1{{binding type 'u' cannot be applied more than once}}
Eg13 e13 : register(u9) : register(u10) : register(u11);

// expected-error@+1{{binding type 't' cannot be applied more than once}}
Eg13 e13_2 : register(t11) : register(t12);

struct Eg14{
MyTemplatedUAV<int> r1;
};
// expected-warning@+1{{binding type 't' only applies to types containing SRV resources}}
Eg14 e14 : register(t9);

struct Eg15 {
float f[4];
};
// expected no error
Eg15 e15 : register(c0);
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify

template<typename T>
struct MyTemplatedUAV {
__hlsl_resource_t [[hlsl::resource_class(UAV)]] x;
};

struct MySRV {
__hlsl_resource_t [[hlsl::resource_class(SRV)]] x;
};

struct MySampler {
__hlsl_resource_t [[hlsl::resource_class(Sampler)]] x;
};

struct MyUAV {
__hlsl_resource_t [[hlsl::resource_class(UAV)]] x;
};

struct MyCBuffer {
__hlsl_resource_t [[hlsl::resource_class(CBuffer)]] x;
};

// Valid: f is skipped, SRVBuf is bound to t0, UAVBuf is bound to u0
struct Eg1 {
float f;
MySRV SRVBuf;
MyUAV UAVBuf;
};
Eg1 e1 : register(t0) : register(u0);

// Valid: f is skipped, SRVBuf is bound to t0, UAVBuf is bound to u0.
// UAVBuf2 gets automatically assigned to u1 even though there is no explicit binding for u1.
struct Eg2 {
float f;
MySRV SRVBuf;
MyUAV UAVBuf;
MyUAV UAVBuf2;
};
Eg2 e2 : register(t0) : register(u0);

// Valid: Bar, the struct within Eg3, has a valid resource that can be bound to t0.
struct Eg3 {
struct Bar {
MyUAV a;
};
Bar b;
};
Eg3 e3 : register(u0);

// Valid: the first sampler state object within 's' is bound to slot 5
struct Eg4 {
MySampler s[3];
};

Eg4 e4 : register(s5);


struct Eg5 {
float f;
};
// expected-warning@+1{{binding type 't' only applies to types containing SRV resources}}
Eg5 e5 : register(t0);

struct Eg6 {
float f;
};
// expected-warning@+1{{binding type 'u' only applies to types containing UAV resources}}
Eg6 e6 : register(u0);

struct Eg7 {
float f;
};
// expected-warning@+1{{binding type 'b' only applies to types containing constant buffer resources}}
Eg7 e7 : register(b0);

struct Eg8 {
float f;
};
// expected-warning@+1{{binding type 's' only applies to types containing sampler state}}
Eg8 e8 : register(s0);

struct Eg9 {
MySRV s;
};
// expected-warning@+1{{binding type 'c' only applies to types containing numeric types}}
Eg9 e9 : register(c0);

struct Eg10{
// expected-error@+1{{'register' attribute only applies to cbuffer/tbuffer and external global variables}}
MyTemplatedUAV<int> a : register(u9);
};
Eg10 e10;


template<typename R>
struct Eg11 {
R b;
};
// expected-warning@+1{{binding type 'u' only applies to types containing UAV resources}}
Eg11<MySRV> e11 : register(u0);
// invalid because after template expansion, there are no valid resources inside Eg11 to bind as a UAV, only an SRV


struct Eg12{
MySRV s1;
MySRV s2;
};
// expected-warning@+2{{binding type 'u' only applies to types containing UAV resources}}
// expected-error@+1{{binding type 'u' cannot be applied more than once}}
Eg12 e12 : register(u9) : register(u10);

struct Eg13{
MySRV s1;
MySRV s2;
};
// expected-warning@+3{{binding type 'u' only applies to types containing UAV resources}}
// expected-error@+2{{binding type 'u' cannot be applied more than once}}
// expected-error@+1{{binding type 'u' cannot be applied more than once}}
Eg13 e13 : register(u9) : register(u10) : register(u11);

// expected-error@+1{{binding type 't' cannot be applied more than once}}
Eg13 e13_2 : register(t11) : register(t12);

struct Eg14{
MyTemplatedUAV<int> r1;
};
// expected-warning@+1{{binding type 't' only applies to types containing SRV resources}}
Eg14 e14 : register(t9);

struct Eg15 {
float f[4];
};
// expected no error
Eg15 e15 : register(c0);
2 changes: 1 addition & 1 deletion clang/tools/scan-build/bin/scan-build.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
perl -S scan-build %*
perl -S scan-build %*
2 changes: 1 addition & 1 deletion clang/tools/scan-build/libexec/c++-analyzer.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
perl -S c++-analyzer %*
perl -S c++-analyzer %*
2 changes: 1 addition & 1 deletion clang/tools/scan-build/libexec/ccc-analyzer.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
perl -S ccc-analyzer %*
perl -S ccc-analyzer %*
2,178 changes: 1,089 additions & 1,089 deletions clang/utils/ClangVisualizers/clang.natvis

Large diffs are not rendered by default.

72 changes: 36 additions & 36 deletions flang/test/Driver/msvc-dependent-lib-flags.f90
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC
! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir -fms-runtime-lib=static_dbg %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC-DEBUG
! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir -fms-runtime-lib=dll %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC-DLL
! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir -fms-runtime-lib=dll_dbg %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC-DLL-DEBUG

! MSVC: -fc1
! MSVC-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-SAME: -D_MT
! MSVC-SAME: --dependent-lib=libcmt
! MSVC-SAME: --dependent-lib=FortranRuntime.static.lib
! MSVC-SAME: --dependent-lib=FortranDecimal.static.lib

! MSVC-DEBUG: -fc1
! MSVC-DEBUG-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-DEBUG-SAME: -D_MT
! MSVC-DEBUG-SAME: -D_DEBUG
! MSVC-DEBUG-SAME: --dependent-lib=libcmtd
! MSVC-DEBUG-SAME: --dependent-lib=FortranRuntime.static_dbg.lib
! MSVC-DEBUG-SAME: --dependent-lib=FortranDecimal.static_dbg.lib

! MSVC-DLL: -fc1
! MSVC-DLL-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-DLL-SAME: -D_MT
! MSVC-DLL-SAME: -D_DLL
! MSVC-DLL-SAME: --dependent-lib=msvcrt
! MSVC-DLL-SAME: --dependent-lib=FortranRuntime.dynamic.lib
! MSVC-DLL-SAME: --dependent-lib=FortranDecimal.dynamic.lib

! MSVC-DLL-DEBUG: -fc1
! MSVC-DLL-DEBUG-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-DLL-DEBUG-SAME: -D_MT
! MSVC-DLL-DEBUG-SAME: -D_DEBUG
! MSVC-DLL-DEBUG-SAME: -D_DLL
! MSVC-DLL-DEBUG-SAME: --dependent-lib=msvcrtd
! MSVC-DLL-DEBUG-SAME: --dependent-lib=FortranRuntime.dynamic_dbg.lib
! MSVC-DLL-DEBUG-SAME: --dependent-lib=FortranDecimal.dynamic_dbg.lib
! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC
! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir -fms-runtime-lib=static_dbg %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC-DEBUG
! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir -fms-runtime-lib=dll %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC-DLL
! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir -fms-runtime-lib=dll_dbg %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC-DLL-DEBUG

! MSVC: -fc1
! MSVC-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-SAME: -D_MT
! MSVC-SAME: --dependent-lib=libcmt
! MSVC-SAME: --dependent-lib=FortranRuntime.static.lib
! MSVC-SAME: --dependent-lib=FortranDecimal.static.lib

! MSVC-DEBUG: -fc1
! MSVC-DEBUG-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-DEBUG-SAME: -D_MT
! MSVC-DEBUG-SAME: -D_DEBUG
! MSVC-DEBUG-SAME: --dependent-lib=libcmtd
! MSVC-DEBUG-SAME: --dependent-lib=FortranRuntime.static_dbg.lib
! MSVC-DEBUG-SAME: --dependent-lib=FortranDecimal.static_dbg.lib

! MSVC-DLL: -fc1
! MSVC-DLL-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-DLL-SAME: -D_MT
! MSVC-DLL-SAME: -D_DLL
! MSVC-DLL-SAME: --dependent-lib=msvcrt
! MSVC-DLL-SAME: --dependent-lib=FortranRuntime.dynamic.lib
! MSVC-DLL-SAME: --dependent-lib=FortranDecimal.dynamic.lib

! MSVC-DLL-DEBUG: -fc1
! MSVC-DLL-DEBUG-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-DLL-DEBUG-SAME: -D_MT
! MSVC-DLL-DEBUG-SAME: -D_DEBUG
! MSVC-DLL-DEBUG-SAME: -D_DLL
! MSVC-DLL-DEBUG-SAME: --dependent-lib=msvcrtd
! MSVC-DLL-DEBUG-SAME: --dependent-lib=FortranRuntime.dynamic_dbg.lib
! MSVC-DLL-DEBUG-SAME: --dependent-lib=FortranDecimal.dynamic_dbg.lib
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

CXX_SOURCES := main.cpp

include Makefile.rules

CXX_SOURCES := main.cpp

include Makefile.rules
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MODULE windows x86 0F45B7919A9646F9BF8F2D6076EA421A11 fizzbuzz.pdb
PUBLIC 1000 0 main
MODULE windows x86 0F45B7919A9646F9BF8F2D6076EA421A11 fizzbuzz.pdb
PUBLIC 1000 0 main
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
CXX_SOURCES := main.cpp
LD_EXTRAS := -L. -l_d -l_c -l_a -l_b

a.out: lib_b lib_a lib_c lib_d

include Makefile.rules

lib_a: lib_b
"$(MAKE)" -f $(MAKEFILE_RULES) \
DYLIB_ONLY=YES DYLIB_CXX_SOURCES=a.cpp DYLIB_NAME=_a \
LD_EXTRAS="-L. -l_b"

lib_b:
"$(MAKE)" -f $(MAKEFILE_RULES) \
DYLIB_ONLY=YES DYLIB_CXX_SOURCES=b.cpp DYLIB_NAME=_b

lib_c:
"$(MAKE)" -f $(MAKEFILE_RULES) \
DYLIB_ONLY=YES DYLIB_CXX_SOURCES=c.cpp DYLIB_NAME=_c

lib_d:
"$(MAKE)" -f $(MAKEFILE_RULES) \
DYLIB_ONLY=YES DYLIB_CXX_SOURCES=d.cpp DYLIB_NAME=_d
CXX_SOURCES := main.cpp
LD_EXTRAS := -L. -l_d -l_c -l_a -l_b

a.out: lib_b lib_a lib_c lib_d

include Makefile.rules

lib_a: lib_b
"$(MAKE)" -f $(MAKEFILE_RULES) \
DYLIB_ONLY=YES DYLIB_CXX_SOURCES=a.cpp DYLIB_NAME=_a \
LD_EXTRAS="-L. -l_b"

lib_b:
"$(MAKE)" -f $(MAKEFILE_RULES) \
DYLIB_ONLY=YES DYLIB_CXX_SOURCES=b.cpp DYLIB_NAME=_b

lib_c:
"$(MAKE)" -f $(MAKEFILE_RULES) \
DYLIB_ONLY=YES DYLIB_CXX_SOURCES=c.cpp DYLIB_NAME=_c

lib_d:
"$(MAKE)" -f $(MAKEFILE_RULES) \
DYLIB_ONLY=YES DYLIB_CXX_SOURCES=d.cpp DYLIB_NAME=_d
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
extern "C" int b_function();

extern "C" int a_function() { return b_function(); }
extern "C" int b_function();

extern "C" int a_function() { return b_function(); }
Original file line number Diff line number Diff line change
@@ -1 +1 @@
extern "C" int b_function() { return 500; }
extern "C" int b_function() { return 500; }
Original file line number Diff line number Diff line change
@@ -1 +1 @@
extern "C" int c_function() { return 600; }
extern "C" int c_function() { return 600; }
Original file line number Diff line number Diff line change
@@ -1 +1 @@
extern "C" int d_function() { return 700; }
extern "C" int d_function() { return 700; }
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#include <stdio.h>

extern "C" int a_function();
extern "C" int c_function();
extern "C" int b_function();
extern "C" int d_function();

int main() {
a_function();
b_function();
c_function();
d_function();

puts("running"); // breakpoint here
return 0;
}
#include <stdio.h>

extern "C" int a_function();
extern "C" int c_function();
extern "C" int b_function();
extern "C" int d_function();

int main() {
a_function();
b_function();
c_function();
d_function();

puts("running"); // breakpoint here
return 0;
}
6 changes: 3 additions & 3 deletions lldb/test/API/functionalities/unwind/zeroth_frame/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
C_SOURCES := main.c

include Makefile.rules
C_SOURCES := main.c

include Makefile.rules
176 changes: 88 additions & 88 deletions lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
"""
Test that line information is recalculated properly for a frame when it moves
from the middle of the backtrace to a zero index.
This is a regression test for a StackFrame bug, where whether frame is zero or
not depends on an internal field. When LLDB was updating its frame list value
of the field wasn't copied into existing StackFrame instances, so those
StackFrame instances, would use an incorrect line entry evaluation logic in
situations if it was in the middle of the stack frame list (not zeroth), and
then moved to the top position. The difference in logic is that for zeroth
frames line entry is returned for program counter, while for other frame
(except for those that "behave like zeroth") it is for the instruction
preceding PC, as PC points to the next instruction after function call. When
the bug is present, when execution stops at the second breakpoint
SBFrame.GetLineEntry() returns line entry for the previous line, rather than
the one with a breakpoint. Note that this is specific to
SBFrame.GetLineEntry(), SBFrame.GetPCAddress().GetLineEntry() would return
correct entry.
This bug doesn't reproduce through an LLDB interpretator, however it happens
when using API directly, for example in LLDB-MI.
"""

import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil


class ZerothFrame(TestBase):
def test(self):
"""
Test that line information is recalculated properly for a frame when it moves
from the middle of the backtrace to a zero index.
"""
self.build()
self.setTearDownCleanup()

exe = self.getBuildArtifact("a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)

main_dot_c = lldb.SBFileSpec("main.c")
bp1 = target.BreakpointCreateBySourceRegex(
"// Set breakpoint 1 here", main_dot_c
)
bp2 = target.BreakpointCreateBySourceRegex(
"// Set breakpoint 2 here", main_dot_c
)

process = target.LaunchSimple(None, None, self.get_process_working_directory())
self.assertTrue(process, VALID_PROCESS)

thread = self.thread()

if self.TraceOn():
print("Backtrace at the first breakpoint:")
for f in thread.frames:
print(f)

# Check that we have stopped at correct breakpoint.
self.assertEqual(
thread.frame[0].GetLineEntry().GetLine(),
bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(),
"LLDB reported incorrect line number.",
)

# Important to use SBProcess::Continue() instead of
# self.runCmd('continue'), because the problem doesn't reproduce with
# 'continue' command.
process.Continue()

if self.TraceOn():
print("Backtrace at the second breakpoint:")
for f in thread.frames:
print(f)
# Check that we have stopped at the breakpoint
self.assertEqual(
thread.frame[0].GetLineEntry().GetLine(),
bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(),
"LLDB reported incorrect line number.",
)
# Double-check with GetPCAddress()
self.assertEqual(
thread.frame[0].GetLineEntry().GetLine(),
thread.frame[0].GetPCAddress().GetLineEntry().GetLine(),
"LLDB reported incorrect line number.",
)
"""
Test that line information is recalculated properly for a frame when it moves
from the middle of the backtrace to a zero index.
This is a regression test for a StackFrame bug, where whether frame is zero or
not depends on an internal field. When LLDB was updating its frame list value
of the field wasn't copied into existing StackFrame instances, so those
StackFrame instances, would use an incorrect line entry evaluation logic in
situations if it was in the middle of the stack frame list (not zeroth), and
then moved to the top position. The difference in logic is that for zeroth
frames line entry is returned for program counter, while for other frame
(except for those that "behave like zeroth") it is for the instruction
preceding PC, as PC points to the next instruction after function call. When
the bug is present, when execution stops at the second breakpoint
SBFrame.GetLineEntry() returns line entry for the previous line, rather than
the one with a breakpoint. Note that this is specific to
SBFrame.GetLineEntry(), SBFrame.GetPCAddress().GetLineEntry() would return
correct entry.
This bug doesn't reproduce through an LLDB interpretator, however it happens
when using API directly, for example in LLDB-MI.
"""

import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil


class ZerothFrame(TestBase):
def test(self):
"""
Test that line information is recalculated properly for a frame when it moves
from the middle of the backtrace to a zero index.
"""
self.build()
self.setTearDownCleanup()

exe = self.getBuildArtifact("a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)

main_dot_c = lldb.SBFileSpec("main.c")
bp1 = target.BreakpointCreateBySourceRegex(
"// Set breakpoint 1 here", main_dot_c
)
bp2 = target.BreakpointCreateBySourceRegex(
"// Set breakpoint 2 here", main_dot_c
)

process = target.LaunchSimple(None, None, self.get_process_working_directory())
self.assertTrue(process, VALID_PROCESS)

thread = self.thread()

if self.TraceOn():
print("Backtrace at the first breakpoint:")
for f in thread.frames:
print(f)

# Check that we have stopped at correct breakpoint.
self.assertEqual(
thread.frame[0].GetLineEntry().GetLine(),
bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(),
"LLDB reported incorrect line number.",
)

# Important to use SBProcess::Continue() instead of
# self.runCmd('continue'), because the problem doesn't reproduce with
# 'continue' command.
process.Continue()

if self.TraceOn():
print("Backtrace at the second breakpoint:")
for f in thread.frames:
print(f)
# Check that we have stopped at the breakpoint
self.assertEqual(
thread.frame[0].GetLineEntry().GetLine(),
bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(),
"LLDB reported incorrect line number.",
)
# Double-check with GetPCAddress()
self.assertEqual(
thread.frame[0].GetLineEntry().GetLine(),
thread.frame[0].GetPCAddress().GetLineEntry().GetLine(),
"LLDB reported incorrect line number.",
)
6 changes: 3 additions & 3 deletions lldb/test/API/python_api/debugger/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CXX_SOURCES := main.cpp

include Makefile.rules
CXX_SOURCES := main.cpp

include Makefile.rules
70 changes: 35 additions & 35 deletions lldb/test/Shell/BuildScript/modes.test
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any -o %t/foo.out foobar.c \
RUN: | FileCheck --check-prefix=COMPILE %s

RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any --outdir %t foo.c bar.c \
RUN: | FileCheck --check-prefix=COMPILE-MULTI %s

RUN: %build -n --verbose --arch=32 --mode=link --compiler=any -o %t/foo.exe foobar.obj \
RUN: | FileCheck --check-prefix=LINK %s

RUN: %build -n --verbose --arch=32 --mode=link --compiler=any -o %t/foobar.exe foo.obj bar.obj \
RUN: | FileCheck --check-prefix=LINK-MULTI %s

RUN: %build -n --verbose --arch=32 --mode=compile-and-link --compiler=any -o %t/foobar.exe foobar.c \
RUN: | FileCheck --check-prefix=BOTH %s

RUN: %build -n --verbose --arch=32 --mode=compile-and-link --compiler=any -o %t/foobar.exe foo.c bar.c \
RUN: | FileCheck --check-prefix=BOTH-MULTI %s


COMPILE: compiling foobar.c -> foo.out

COMPILE-MULTI: compiling foo.c -> foo.o{{(bj)?}}
COMPILE-MULTI: compiling bar.c -> bar.o{{(bj)?}}


LINK: linking foobar.obj -> foo.exe

LINK-MULTI: linking foo.obj+bar.obj -> foobar.exe

BOTH: compiling foobar.c -> [[OBJFOO:foobar.exe-foobar.o(bj)?]]
BOTH: linking [[OBJFOO]] -> foobar.exe

BOTH-MULTI: compiling foo.c -> [[OBJFOO:foobar.exe-foo.o(bj)?]]
BOTH-MULTI: compiling bar.c -> [[OBJBAR:foobar.exe-bar.o(bj)?]]
BOTH-MULTI: linking [[OBJFOO]]+[[OBJBAR]] -> foobar.exe
RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any -o %t/foo.out foobar.c \
RUN: | FileCheck --check-prefix=COMPILE %s
RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any --outdir %t foo.c bar.c \
RUN: | FileCheck --check-prefix=COMPILE-MULTI %s
RUN: %build -n --verbose --arch=32 --mode=link --compiler=any -o %t/foo.exe foobar.obj \
RUN: | FileCheck --check-prefix=LINK %s
RUN: %build -n --verbose --arch=32 --mode=link --compiler=any -o %t/foobar.exe foo.obj bar.obj \
RUN: | FileCheck --check-prefix=LINK-MULTI %s
RUN: %build -n --verbose --arch=32 --mode=compile-and-link --compiler=any -o %t/foobar.exe foobar.c \
RUN: | FileCheck --check-prefix=BOTH %s
RUN: %build -n --verbose --arch=32 --mode=compile-and-link --compiler=any -o %t/foobar.exe foo.c bar.c \
RUN: | FileCheck --check-prefix=BOTH-MULTI %s
COMPILE: compiling foobar.c -> foo.out
COMPILE-MULTI: compiling foo.c -> foo.o{{(bj)?}}
COMPILE-MULTI: compiling bar.c -> bar.o{{(bj)?}}
LINK: linking foobar.obj -> foo.exe
LINK-MULTI: linking foo.obj+bar.obj -> foobar.exe
BOTH: compiling foobar.c -> [[OBJFOO:foobar.exe-foobar.o(bj)?]]
BOTH: linking [[OBJFOO]] -> foobar.exe
BOTH-MULTI: compiling foo.c -> [[OBJFOO:foobar.exe-foo.o(bj)?]]
BOTH-MULTI: compiling bar.c -> [[OBJBAR:foobar.exe-bar.o(bj)?]]
BOTH-MULTI: linking [[OBJFOO]]+[[OBJBAR]] -> foobar.exe
64 changes: 32 additions & 32 deletions lldb/test/Shell/BuildScript/script-args.test
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any -o %t/foo.out foobar.c \
RUN: | FileCheck %s
RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any --outdir %t foo.c bar.c \
RUN: | FileCheck --check-prefix=MULTI-INPUT %s


CHECK: Script Arguments:
CHECK-NEXT: Arch: 32
CHECK: Compiler: any
CHECK: Outdir: {{.*}}script-args.test.tmp
CHECK: Output: {{.*}}script-args.test.tmp{{.}}foo.out
CHECK: Nodefaultlib: False
CHECK: Opt: none
CHECK: Mode: compile
CHECK: Clean: True
CHECK: Verbose: True
CHECK: Dryrun: True
CHECK: Inputs: foobar.c

MULTI-INPUT: Script Arguments:
MULTI-INPUT-NEXT: Arch: 32
MULTI-INPUT-NEXT: Compiler: any
MULTI-INPUT-NEXT: Outdir: {{.*}}script-args.test.tmp
MULTI-INPUT-NEXT: Output:
MULTI-INPUT-NEXT: Nodefaultlib: False
MULTI-INPUT-NEXT: Opt: none
MULTI-INPUT-NEXT: Mode: compile
MULTI-INPUT-NEXT: Clean: True
MULTI-INPUT-NEXT: Verbose: True
MULTI-INPUT-NEXT: Dryrun: True
MULTI-INPUT-NEXT: Inputs: foo.c
MULTI-INPUT-NEXT: bar.c
RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any -o %t/foo.out foobar.c \
RUN: | FileCheck %s
RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any --outdir %t foo.c bar.c \
RUN: | FileCheck --check-prefix=MULTI-INPUT %s
CHECK: Script Arguments:
CHECK-NEXT: Arch: 32
CHECK: Compiler: any
CHECK: Outdir: {{.*}}script-args.test.tmp
CHECK: Output: {{.*}}script-args.test.tmp{{.}}foo.out
CHECK: Nodefaultlib: False
CHECK: Opt: none
CHECK: Mode: compile
CHECK: Clean: True
CHECK: Verbose: True
CHECK: Dryrun: True
CHECK: Inputs: foobar.c
MULTI-INPUT: Script Arguments:
MULTI-INPUT-NEXT: Arch: 32
MULTI-INPUT-NEXT: Compiler: any
MULTI-INPUT-NEXT: Outdir: {{.*}}script-args.test.tmp
MULTI-INPUT-NEXT: Output:
MULTI-INPUT-NEXT: Nodefaultlib: False
MULTI-INPUT-NEXT: Opt: none
MULTI-INPUT-NEXT: Mode: compile
MULTI-INPUT-NEXT: Clean: True
MULTI-INPUT-NEXT: Verbose: True
MULTI-INPUT-NEXT: Dryrun: True
MULTI-INPUT-NEXT: Inputs: foo.c
MULTI-INPUT-NEXT: bar.c
98 changes: 49 additions & 49 deletions lldb/test/Shell/BuildScript/toolchain-clang-cl.test
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
REQUIRES: lld, system-windows

RUN: %build -n --verbose --arch=32 --compiler=clang-cl --mode=compile-and-link -o %t/foo.exe foobar.c \
RUN: | FileCheck --check-prefix=CHECK-32 %s

RUN: %build -n --verbose --arch=64 --compiler=clang-cl --mode=compile-and-link -o %t/foo.exe foobar.c \
RUN: | FileCheck --check-prefix=CHECK-64 %s

CHECK-32: Script Arguments:
CHECK-32: Arch: 32
CHECK-32: Compiler: clang-cl
CHECK-32: Outdir: {{.*}}
CHECK-32: Output: {{.*}}toolchain-clang-cl.test.tmp\foo.exe
CHECK-32: Nodefaultlib: False
CHECK-32: Opt: none
CHECK-32: Mode: compile
CHECK-32: Clean: True
CHECK-32: Verbose: True
CHECK-32: Dryrun: True
CHECK-32: Inputs: foobar.c
CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.ilk
CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
CHECK-32: compiling foobar.c -> foo.exe-foobar.obj
CHECK-32: {{.*}}clang-cl{{(\.EXE)?}} -m32
CHECK-32: linking foo.exe-foobar.obj -> foo.exe
CHECK-32: {{.*}}lld-link{{(\.EXE)?}}

CHECK-64: Script Arguments:
CHECK-64: Arch: 64
CHECK-64: Compiler: clang-cl
CHECK-64: Outdir: {{.*}}
CHECK-64: Output: {{.*}}toolchain-clang-cl.test.tmp\foo.exe
CHECK-64: Nodefaultlib: False
CHECK-64: Opt: none
CHECK-64: Mode: compile
CHECK-64: Clean: True
CHECK-64: Verbose: True
CHECK-64: Dryrun: True
CHECK-64: Inputs: foobar.c
CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.ilk
CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
CHECK-64: compiling foobar.c -> foo.exe-foobar.obj
CHECK-64: {{.*}}clang-cl{{(\.EXE)?}} -m64
CHECK-64: linking foo.exe-foobar.obj -> foo.exe
CHECK-64: {{.*}}lld-link{{(\.EXE)?}}
REQUIRES: lld, system-windows
RUN: %build -n --verbose --arch=32 --compiler=clang-cl --mode=compile-and-link -o %t/foo.exe foobar.c \
RUN: | FileCheck --check-prefix=CHECK-32 %s
RUN: %build -n --verbose --arch=64 --compiler=clang-cl --mode=compile-and-link -o %t/foo.exe foobar.c \
RUN: | FileCheck --check-prefix=CHECK-64 %s
CHECK-32: Script Arguments:
CHECK-32: Arch: 32
CHECK-32: Compiler: clang-cl
CHECK-32: Outdir: {{.*}}
CHECK-32: Output: {{.*}}toolchain-clang-cl.test.tmp\foo.exe
CHECK-32: Nodefaultlib: False
CHECK-32: Opt: none
CHECK-32: Mode: compile
CHECK-32: Clean: True
CHECK-32: Verbose: True
CHECK-32: Dryrun: True
CHECK-32: Inputs: foobar.c
CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.ilk
CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
CHECK-32: compiling foobar.c -> foo.exe-foobar.obj
CHECK-32: {{.*}}clang-cl{{(\.EXE)?}} -m32
CHECK-32: linking foo.exe-foobar.obj -> foo.exe
CHECK-32: {{.*}}lld-link{{(\.EXE)?}}
CHECK-64: Script Arguments:
CHECK-64: Arch: 64
CHECK-64: Compiler: clang-cl
CHECK-64: Outdir: {{.*}}
CHECK-64: Output: {{.*}}toolchain-clang-cl.test.tmp\foo.exe
CHECK-64: Nodefaultlib: False
CHECK-64: Opt: none
CHECK-64: Mode: compile
CHECK-64: Clean: True
CHECK-64: Verbose: True
CHECK-64: Dryrun: True
CHECK-64: Inputs: foobar.c
CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.ilk
CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
CHECK-64: compiling foobar.c -> foo.exe-foobar.obj
CHECK-64: {{.*}}clang-cl{{(\.EXE)?}} -m64
CHECK-64: linking foo.exe-foobar.obj -> foo.exe
CHECK-64: {{.*}}lld-link{{(\.EXE)?}}
80 changes: 40 additions & 40 deletions lldb/test/Shell/Minidump/Windows/Sigsegv/Inputs/sigsegv.cpp
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@

// nodefaultlib build: cl -Zi sigsegv.cpp /link /nodefaultlib

#ifdef USE_CRT
#include <stdio.h>
#else
int main();
extern "C"
{
int _fltused;
void mainCRTStartup() { main(); }
void printf(const char*, ...) {}
}
#endif

void crash(bool crash_self)
{
printf("Before...\n");
if(crash_self)
{
printf("Crashing in 3, 2, 1 ...\n");
*(volatile int*)nullptr = 0;
}
printf("After...\n");
}

int foo(int x, float y, const char* msg)
{
bool flag = x > y;
if(flag)
printf("x = %d, y = %f, msg = %s\n", x, y, msg);
crash(flag);
return x << 1;
}

int main()
{
foo(10, 3.14, "testing");
}


// nodefaultlib build: cl -Zi sigsegv.cpp /link /nodefaultlib

#ifdef USE_CRT
#include <stdio.h>
#else
int main();
extern "C"
{
int _fltused;
void mainCRTStartup() { main(); }
void printf(const char*, ...) {}
}
#endif

void crash(bool crash_self)
{
printf("Before...\n");
if(crash_self)
{
printf("Crashing in 3, 2, 1 ...\n");
*(volatile int*)nullptr = 0;
}
printf("After...\n");
}

int foo(int x, float y, const char* msg)
{
bool flag = x > y;
if(flag)
printf("x = %d, y = %f, msg = %s\n", x, y, msg);
crash(flag);
return x << 1;
}

int main()
{
foo(10, 3.14, "testing");
}

Loading