This revision was automatically updated to reflect the committed changes. Closed by commit rL368322: clang: Diag running out of file handles while looking for files (authored by nico, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D65956?vs=214166&id=214192#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65956/new/ https://reviews.llvm.org/D65956 Files: cfe/trunk/lib/Lex/HeaderSearch.cpp Index: cfe/trunk/lib/Lex/HeaderSearch.cpp =================================================================== --- cfe/trunk/lib/Lex/HeaderSearch.cpp +++ cfe/trunk/lib/Lex/HeaderSearch.cpp @@ -309,9 +309,18 @@ ModuleMap::KnownHeader *SuggestedModule) { // If we have a module map that might map this header, load it and // check whether we'll have a suggestion for a module. - auto File = getFileMgr().getFile(FileName, /*OpenFile=*/true); - if (!File) + llvm::ErrorOr<const FileEntry *> File = + getFileMgr().getFile(FileName, /*OpenFile=*/true); + if (!File) { + // For rare, surprising errors (e.g. "out of file handles"), diag the EC + // message. + std::error_code EC = File.getError(); + if (EC != std::errc::no_such_file_or_directory && + EC != std::errc::is_a_directory) { + Diags.Report(IncludeLoc, diag::err_cannot_open_file) << EC.message(); + } return nullptr; + } // If there is a module that corresponds to this header, suggest it. if (!findUsableModuleForHeader(*File, Dir ? Dir : (*File)->getDir(),
Index: cfe/trunk/lib/Lex/HeaderSearch.cpp =================================================================== --- cfe/trunk/lib/Lex/HeaderSearch.cpp +++ cfe/trunk/lib/Lex/HeaderSearch.cpp @@ -309,9 +309,18 @@ ModuleMap::KnownHeader *SuggestedModule) { // If we have a module map that might map this header, load it and // check whether we'll have a suggestion for a module. - auto File = getFileMgr().getFile(FileName, /*OpenFile=*/true); - if (!File) + llvm::ErrorOr<const FileEntry *> File = + getFileMgr().getFile(FileName, /*OpenFile=*/true); + if (!File) { + // For rare, surprising errors (e.g. "out of file handles"), diag the EC + // message. + std::error_code EC = File.getError(); + if (EC != std::errc::no_such_file_or_directory && + EC != std::errc::is_a_directory) { + Diags.Report(IncludeLoc, diag::err_cannot_open_file) << EC.message(); + } return nullptr; + } // If there is a module that corresponds to this header, suggest it. if (!findUsableModuleForHeader(*File, Dir ? Dir : (*File)->getDir(),
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits