Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions clang/lib/Driver/ToolChains/HIPAMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,19 +372,22 @@ HIPAMDToolChain::getDeviceLibs(const llvm::opt::ArgList &DriverArgs) const {
// Maintain compatability with --hip-device-lib.
auto BCLibArgs = DriverArgs.getAllArgValues(options::OPT_hip_device_lib_EQ);
if (!BCLibArgs.empty()) {
llvm::for_each(BCLibArgs, [&](StringRef BCName) {
for (StringRef BCName : BCLibArgs) {
StringRef FullName;
bool Found = false;
for (StringRef LibraryPath : LibraryPaths) {
SmallString<128> Path(LibraryPath);
llvm::sys::path::append(Path, BCName);
FullName = Path;
if (llvm::sys::fs::exists(FullName)) {
BCLibs.emplace_back(FullName);
return;
Found = true;
break;
}
}
getDriver().Diag(diag::err_drv_no_such_file) << BCName;
});
if (!Found)
getDriver().Diag(diag::err_drv_no_such_file) << BCName;
}
} else {
if (!RocmInstallation->hasDeviceLibrary()) {
getDriver().Diag(diag::err_drv_no_rocm_device_lib) << 0;
Expand Down
11 changes: 7 additions & 4 deletions clang/lib/Driver/ToolChains/HIPSPV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,22 @@ HIPSPVToolChain::getDeviceLibs(const llvm::opt::ArgList &DriverArgs) const {
// Maintain compatability with --hip-device-lib.
auto BCLibArgs = DriverArgs.getAllArgValues(options::OPT_hip_device_lib_EQ);
if (!BCLibArgs.empty()) {
llvm::for_each(BCLibArgs, [&](StringRef BCName) {
bool Found = false;
for (StringRef BCName : BCLibArgs) {
StringRef FullName;
for (std::string LibraryPath : LibraryPaths) {
SmallString<128> Path(LibraryPath);
llvm::sys::path::append(Path, BCName);
FullName = Path;
if (llvm::sys::fs::exists(FullName)) {
BCLibs.emplace_back(FullName.str());
return;
Found = true;
break;
}
}
getDriver().Diag(diag::err_drv_no_such_file) << BCName;
});
if (!Found)
getDriver().Diag(diag::err_drv_no_such_file) << BCName;
}
} else {
// Search device library named as 'hipspv-<triple>.bc'.
auto TT = getTriple().normalize();
Expand Down
Loading