File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
clang/lib/Driver/ToolChains Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -372,19 +372,22 @@ HIPAMDToolChain::getDeviceLibs(const llvm::opt::ArgList &DriverArgs) const {
372
372
// Maintain compatability with --hip-device-lib.
373
373
auto BCLibArgs = DriverArgs.getAllArgValues (options::OPT_hip_device_lib_EQ);
374
374
if (!BCLibArgs.empty ()) {
375
- llvm::for_each (BCLibArgs, [&] (StringRef BCName) {
375
+ for (StringRef BCName : BCLibArgs ) {
376
376
StringRef FullName;
377
+ bool Found = false ;
377
378
for (StringRef LibraryPath : LibraryPaths) {
378
379
SmallString<128 > Path (LibraryPath);
379
380
llvm::sys::path::append (Path, BCName);
380
381
FullName = Path;
381
382
if (llvm::sys::fs::exists (FullName)) {
382
383
BCLibs.emplace_back (FullName);
383
- return ;
384
+ Found = true ;
385
+ break ;
384
386
}
385
387
}
386
- getDriver ().Diag (diag::err_drv_no_such_file) << BCName;
387
- });
388
+ if (!Found)
389
+ getDriver ().Diag (diag::err_drv_no_such_file) << BCName;
390
+ }
388
391
} else {
389
392
if (!RocmInstallation->hasDeviceLibrary ()) {
390
393
getDriver ().Diag (diag::err_drv_no_rocm_device_lib) << 0 ;
Original file line number Diff line number Diff line change @@ -226,19 +226,22 @@ HIPSPVToolChain::getDeviceLibs(const llvm::opt::ArgList &DriverArgs) const {
226
226
// Maintain compatability with --hip-device-lib.
227
227
auto BCLibArgs = DriverArgs.getAllArgValues (options::OPT_hip_device_lib_EQ);
228
228
if (!BCLibArgs.empty ()) {
229
- llvm::for_each (BCLibArgs, [&](StringRef BCName) {
229
+ bool Found = false ;
230
+ for (StringRef BCName : BCLibArgs) {
230
231
StringRef FullName;
231
232
for (std::string LibraryPath : LibraryPaths) {
232
233
SmallString<128 > Path (LibraryPath);
233
234
llvm::sys::path::append (Path, BCName);
234
235
FullName = Path;
235
236
if (llvm::sys::fs::exists (FullName)) {
236
237
BCLibs.emplace_back (FullName.str ());
237
- return ;
238
+ Found = true ;
239
+ break ;
238
240
}
239
241
}
240
- getDriver ().Diag (diag::err_drv_no_such_file) << BCName;
241
- });
242
+ if (!Found)
243
+ getDriver ().Diag (diag::err_drv_no_such_file) << BCName;
244
+ }
242
245
} else {
243
246
// Search device library named as 'hipspv-<triple>.bc'.
244
247
auto TT = getTriple ().normalize ();
You can’t perform that action at this time.
0 commit comments