================ @@ -7403,41 +7403,36 @@ static void handleHLSLResourceBindingAttr(Sema &S, Decl *D, } switch (RC) { case llvm::hlsl::ResourceClass::SRV: { - if (Slot.substr(0, 1) != "t") + if (Slot[0] != 't') S.Diag(ArgLoc, diag::err_hlsl_mismatching_register_type_and_name) << Slot.substr(0, 1) << varTy << "t"; break; } case llvm::hlsl::ResourceClass::UAV: { - if (Slot.substr(0, 1) != "u") + if (Slot[0] != 'u') S.Diag(ArgLoc, diag::err_hlsl_mismatching_register_type_and_name) << Slot.substr(0, 1) << varTy << "u"; break; } case llvm::hlsl::ResourceClass::CBuffer: { - if (Slot.substr(0, 1) != "b") + if (Slot[0] != 'b') S.Diag(ArgLoc, diag::err_hlsl_mismatching_register_type_and_name) << Slot.substr(0, 1) << varTy << "b"; break; } case llvm::hlsl::ResourceClass::Sampler: { - if (Slot.substr(0, 1) != "s") + if (Slot[0] != 's') S.Diag(ArgLoc, diag::err_hlsl_mismatching_register_type_and_name) << Slot.substr(0, 1) << varTy << "s"; break; } - case llvm::hlsl::ResourceClass::Invalid: { + default: { ---------------- llvm-beanz wrote:
It would be better to have this be the Invalid case. Then the compiler will warn if new enum values get added that aren't handled. https://github.com/llvm/llvm-project/pull/87578 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits