[PATCH] D65956: clang: Diag running out of file handles while looking for files

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 8 10:59:01 PDT 2019


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(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65956.214192.patch
Type: text/x-patch
Size: 1075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190808/d96b366a/attachment.bin>


More information about the cfe-commits mailing list