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

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


https://github.com/Labman-001 created https://github.com/llvm/llvm-project/pull/94336

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">


>From 673778784c089d0146b293bd5c6c7331d736fb25 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Tue, 4 Jun 2024 18:31:03 +0800
Subject: [PATCH] Give a warning when now dwo found

---
 llvm/tools/llvm-dwp/llvm-dwp.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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";



More information about the llvm-commits mailing list