auto ExpectedAS =
D ? D->getType().getAddressSpace()
- : (LangOpts.OpenCL ? LangAS::opencl_global : LangAS::Default);
+ : static_cast<unsigned>(LangOpts.OpenCL ? LangAS::opencl_global
+ : LangAS::Default);
assert(getContext().getTargetAddressSpace(ExpectedAS) ==
Ty->getPointerAddressSpace());
if (AddrSpace != ExpectedAS)
unsigned CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D) {
unsigned AddrSpace;
if (LangOpts.OpenCL) {
- AddrSpace = D ? D->getType().getAddressSpace() : LangAS::opencl_global;
+ AddrSpace = D ? D->getType().getAddressSpace()
+ : static_cast<unsigned>(LangAS::opencl_global);
assert(AddrSpace == LangAS::opencl_global ||
AddrSpace == LangAS::opencl_constant ||
AddrSpace == LangAS::opencl_local ||
assert(!CGM.getLangOpts().OpenCL &&
!(CGM.getLangOpts().CUDA && CGM.getLangOpts().CUDAIsDevice) &&
"Address space agnostic languages only");
- return D ? D->getType().getAddressSpace() : LangAS::Default;
+ return D ? D->getType().getAddressSpace()
+ : static_cast<unsigned>(LangAS::Default);
}
llvm::Value *TargetCodeGenInfo::performAddrSpaceCast(