//META: generated=true
//META: model=claude-opus-4-7
//META: generated_at=2026-05-20T18:00:00+00:00
//META: source_commit=1e0d460c1cb410005c4f775ba11fbc803cc8c16d
//META: doc_ref=docs/generated/design/pipeline/05-ir-passes.md#ssa-construction-and-basic-cleanup
//META: doc_section_digest=908553c64f782960d2c5717a98c49179101f5061838a971f9566e0daf48453d4
//META: purpose=The missing-return pass diagnoses paths missing a return in a non-void function.
//META: intent=negative
//META: pipeline_stage=ir-pass
//META: warning=Auto-generated. May drift from source. Do not edit by hand.

// A non-void function with a return only on one branch triggers the
// missing-return diagnostic from `slang-ir-missing-return.cpp`.

//DIAGNOSTIC_TEST:SIMPLE(diag=CHECK):-target hlsl -stage compute -entry main

uniform int x;
uniform RWStructuredBuffer<int> buf;

int foo(int n)
/*CHECK:
    ^^^ non-void function does not return in all cases
*/
// CHECK: W41010
{
    if (n > 0) return n;
}

[numthreads(1, 1, 1)]
void main(uint3 tid : SV_DispatchThreadID)
{
    buf[0] = foo(x);
}
