Unverified Commit b87b0945 authored by Joshua Batista's avatar Joshua Batista Committed by GitHub
Browse files

[NFC][HLSL] Remove dead branch for const return by value (#194983)

Remove unreachable addConst() on the by-value return path of
addHandleAccessFunction.
No caller passes IsConstReturn=true with IsRef=false. The existing AST
tests ( StructuredBuffers-AST.hlsl, ByteAddressBuffers-AST.hlsl,
TypedBuffers-AST.hlsl) already assert the by-value Load return type is
non-const, so behavior is verified unchanged.


Assisted by: Github Copilot
Fixes https://github.com/llvm/llvm-project/issues/194982
parent e29aa9ef
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2262,9 +2262,9 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addHandleAccessFunction(
      ReturnTy.addConst();
    ReturnTy = AST.getLValueReferenceType(ReturnTy);
  } else {
    assert(!IsConstReturn && "There shouldn't be any resource methods with a "
                             "const ref return value");
    ReturnTy = ElemTy;
    if (IsConstReturn)
      ReturnTy.addConst();
  }
  MMB.ReturnTy = ReturnTy;