aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-dwp/llvm-dwp.cpp
diff options
context:
space:
mode:
authorJinjie Huang <huangjinjie@bytedance.com>2024-06-28 01:47:34 +0800
committerGitHub <noreply@github.com>2024-06-27 10:47:34 -0700
commitd7cd41e571cb8def7914cce51b49e009f8851634 (patch)
treeca6cf20e708dc165d5d3f43622ee44e9f377b8cd /llvm/tools/llvm-dwp/llvm-dwp.cpp
parentabfff89b743584d2796000318198bf60d3622a1f (diff)
downloadllvm-d7cd41e571cb8def7914cce51b49e009f8851634.zip
llvm-d7cd41e571cb8def7914cce51b49e009f8851634.tar.gz
llvm-d7cd41e571cb8def7914cce51b49e009f8851634.tar.bz2
Give a warning when no dwo files are provided (#94336)
In some scenarios based on the split-dwarf build process, the dwo file is not generated as expected(That is to say, no dwo file path is stored in the binary). When the llvm-dwp tool is called to generate the .dwp file, it will exit without any warning. So, the plan is to prompt a warning to tell the user that the dwo file was not actually generated. <img width="699" alt="image" src="https://github.com/llvm/llvm-project/assets/150100070/5e5742f6-daad-450f-87e9-cb25449c3c7a">
Diffstat (limited to 'llvm/tools/llvm-dwp/llvm-dwp.cpp')
-rw-r--r--llvm/tools/llvm-dwp/llvm-dwp.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 4c4f2a9..18f4f1a 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -188,8 +188,11 @@ 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>(
+ "executable file does not contain any references to dwo files"));
return 0;
+ }
std::string ErrorStr;
StringRef Context = "dwarf streamer init";