diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp index 3103f1798e14e..7d5d2e9057f9e 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.cpp +++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp @@ -585,12 +585,12 @@ static void initializeBuffer(CodeGenModule &CGM, llvm::GlobalVariable *GV, void CGHLSLRuntime::initializeBufferFromBinding(const HLSLBufferDecl *BufDecl, llvm::GlobalVariable *GV, HLSLResourceBindingAttr *RBA) { + assert(RBA && "expect a nonnull binding attribute"); llvm::Type *Int1Ty = llvm::Type::getInt1Ty(CGM.getLLVMContext()); auto *NonUniform = llvm::ConstantInt::get(Int1Ty, false); auto *Index = llvm::ConstantInt::get(CGM.IntTy, 0); auto *RangeSize = llvm::ConstantInt::get(CGM.IntTy, 1); - auto *Space = - llvm::ConstantInt::get(CGM.IntTy, RBA ? RBA->getSpaceNumber() : 0); + auto *Space = llvm::ConstantInt::get(CGM.IntTy, RBA->getSpaceNumber()); Value *Name = nullptr; llvm::Intrinsic::ID IntrinsicID = diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp index 506da8a361edf..4d61ced9b0787 100644 --- a/clang/lib/Sema/SemaHLSL.cpp +++ b/clang/lib/Sema/SemaHLSL.cpp @@ -2418,7 +2418,7 @@ static bool CheckFloatOrHalfRepresentation(Sema *S, SourceLocation Loc, clang::QualType PassedType) { clang::QualType BaseType = PassedType->isVectorType() - ? PassedType->getAs()->getElementType() + ? PassedType->castAs()->getElementType() : PassedType; if (!BaseType->isHalfType() && !BaseType->isFloat32Type()) return S->Diag(Loc, diag::err_builtin_invalid_arg_type)