diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp index 7bbdb71b1e24f..1097b714f6c24 100644 --- a/clang/lib/Driver/ToolChains/AMDGPU.cpp +++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp @@ -147,8 +147,7 @@ void RocmInstallationDetector::scanLibDevicePath(llvm::StringRef Path) { llvm::Twine GfxName = Twine("gfx") + IsaVersionNumber; SmallString<8> Tmp; - LibDeviceMap.insert( - std::make_pair(GfxName.toStringRef(Tmp), FilePath.str())); + LibDeviceMap.insert({GfxName.toStringRef(Tmp), FilePath.str()}); } } } @@ -339,7 +338,7 @@ RocmInstallationDetector::RocmInstallationDetector( unsigned Minor = ~0U; SmallVector Parts; HIPVersionArg.split(Parts, '.'); - if (Parts.size()) + if (!Parts.empty()) Parts[0].getAsInteger(0, Major); if (Parts.size() > 1) Parts[1].getAsInteger(0, Minor); @@ -373,7 +372,7 @@ void RocmInstallationDetector::detectDeviceLibrary() { assert(LibDevicePath.empty()); if (!RocmDeviceLibPathArg.empty()) - LibDevicePath = RocmDeviceLibPathArg[RocmDeviceLibPathArg.size() - 1]; + LibDevicePath = RocmDeviceLibPathArg.back(); else if (std::optional LibPathEnv = llvm::sys::Process::GetEnv("HIP_DEVICE_LIB_PATH")) LibDevicePath = std::move(*LibPathEnv); diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp b/clang/lib/Driver/ToolChains/HIPAMD.cpp index 5b1bc6d8b6fd7..b08f610b21a16 100644 --- a/clang/lib/Driver/ToolChains/HIPAMD.cpp +++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp @@ -207,8 +207,7 @@ void AMDGCN::Linker::ConstructJob(Compilation &C, const JobAction &JA, const InputInfoList &Inputs, const ArgList &Args, const char *LinkingOutput) const { - if (Inputs.size() > 0 && - Inputs[0].getType() == types::TY_Image && + if (!Inputs.empty() && Inputs[0].getType() == types::TY_Image && JA.getType() == types::TY_Object) return HIP::constructGenerateObjFileFromHIPFatBinary(C, Output, Inputs, Args, JA, *this);