[PATCH] D136090: Handle errors in expansion of response files

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 22 22:37:16 PDT 2022


mgorny added inline comments.


================
Comment at: clang/lib/Driver/Driver.cpp:1029
         if (llvm::sys::path::is_relative(CfgFilePath)) {
-          if (getVFS().makeAbsolute(CfgFilePath))
-            return true;
-          auto Status = getVFS().status(CfgFilePath);
-          if (!Status ||
-              Status->getType() != llvm::sys::fs::file_type::regular_file) {
-            Diag(diag::err_drv_config_file_not_exist) << CfgFilePath;
+          if (std::error_code EC = getVFS().makeAbsolute(CfgFilePath)) {
+            Diag(diag::err_drv_cannot_open_config_file)
----------------
Either I'm missing something or you're not using `EC`.


================
Comment at: clang/lib/Driver/Driver.cpp:1041
+        }
+        if (Status->getType() != llvm::sys::fs::file_type::regular_file) {
+          Diag(diag::err_drv_cannot_open_config_file)
----------------
Not necessarily a goal for this patch but wouldn't this check fit better in `readConfigFile()`?


================
Comment at: clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp:67-69
+      if (Err) {
+        llvm::errs() << Err;
+      }
----------------
The braces seem unnecessary.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136090/new/

https://reviews.llvm.org/D136090



More information about the cfe-commits mailing list