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 {
372372 // Maintain compatability with --hip-device-lib.
373373 auto BCLibArgs = DriverArgs.getAllArgValues (options::OPT_hip_device_lib_EQ);
374374 if (!BCLibArgs.empty ()) {
375- llvm::for_each (BCLibArgs, [&] (StringRef BCName) {
375+ for (StringRef BCName : BCLibArgs ) {
376376 StringRef FullName;
377+ bool Found = false ;
377378 for (StringRef LibraryPath : LibraryPaths) {
378379 SmallString<128 > Path (LibraryPath);
379380 llvm::sys::path::append (Path, BCName);
380381 FullName = Path;
381382 if (llvm::sys::fs::exists (FullName)) {
382383 BCLibs.emplace_back (FullName);
383- return ;
384+ Found = true ;
385+ break ;
384386 }
385387 }
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+ }
388391 } else {
389392 if (!RocmInstallation->hasDeviceLibrary ()) {
390393 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 {
226226 // Maintain compatability with --hip-device-lib.
227227 auto BCLibArgs = DriverArgs.getAllArgValues (options::OPT_hip_device_lib_EQ);
228228 if (!BCLibArgs.empty ()) {
229- llvm::for_each (BCLibArgs, [&](StringRef BCName) {
229+ bool Found = false ;
230+ for (StringRef BCName : BCLibArgs) {
230231 StringRef FullName;
231232 for (std::string LibraryPath : LibraryPaths) {
232233 SmallString<128 > Path (LibraryPath);
233234 llvm::sys::path::append (Path, BCName);
234235 FullName = Path;
235236 if (llvm::sys::fs::exists (FullName)) {
236237 BCLibs.emplace_back (FullName.str ());
237- return ;
238+ Found = true ;
239+ break ;
238240 }
239241 }
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+ }
242245 } else {
243246 // Search device library named as 'hipspv-<triple>.bc'.
244247 auto TT = getTriple ().normalize ();
You can’t perform that action at this time.
0 commit comments