[llvm] Give a warning when no dwo files are found (PR #94336)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 03:55:45 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-debuginfo

Author: Jinjie Huang  (Labman-001)

<details>
<summary>Changes</summary>

In some scenarios based on the split-dwarf build process, the dwo file is not generated as expected. When the llvm-dwp tool is called to generate the .dwp file, it will exit without any warning. 
The plan is to prompt a warning to tell the user that the dwo files was not actually generated(That is to say, no dwo file path is stored in the binary).
<img width="173" alt="image" src="https://github.com/llvm/llvm-project/assets/150100070/c7e671fa-4558-4a41-8cc6-f894ab4356b8">


---
Full diff: https://github.com/llvm/llvm-project/pull/94336.diff


1 Files Affected:

- (modified) llvm/tools/llvm-dwp/llvm-dwp.cpp (+3-1) 


``````````diff
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 81556b3ad4bcb..f0edaeb07f0ba 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -188,8 +188,10 @@ int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
                         std::make_move_iterator(DWOs->end()));
   }
 
-  if (DWOFilenames.empty())
+  if (DWOFilenames.empty()) {
+    WithColor::defaultWarningHandler(make_error<DWPError>("No dwo files found!\n"));
     return 0;
+  }
 
   std::string ErrorStr;
   StringRef Context = "dwarf streamer init";

``````````

</details>


https://github.com/llvm/llvm-project/pull/94336


More information about the llvm-commits mailing list