[llvm] 55b556e - [llvm-size] Fix hang waiting for input on invalid short commandline option
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 18 07:02:04 PDT 2022
Author: gbreynoo
Date: 2022-07-18T14:53:20+01:00
New Revision: 55b556e60c06e0556f52163fd99e8779d606194e
URL: https://github.com/llvm/llvm-project/commit/55b556e60c06e0556f52163fd99e8779d606194e
DIFF: https://github.com/llvm/llvm-project/commit/55b556e60c06e0556f52163fd99e8779d606194e.diff
LOG: [llvm-size] Fix hang waiting for input on invalid short commandline option
When an invalid shot command line option was used (e.g. -v) llvm-size
would hang waiting on input from stdin. This change fixes this issue by
bringing llvm-size in line with other llvm tools and exiting early when
this error is output.
Differential Revision: https://reviews.llvm.org/D129866
Added:
Modified:
llvm/tools/llvm-size/llvm-size.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-size/llvm-size.cpp b/llvm/tools/llvm-size/llvm-size.cpp
index ec9a4cde56b6e..1c7484ba5496b 100644
--- a/llvm/tools/llvm-size/llvm-size.cpp
+++ b/llvm/tools/llvm-size/llvm-size.cpp
@@ -868,8 +868,11 @@ int main(int argc, char **argv) {
StringSaver Saver(A);
SizeOptTable Tbl;
ToolName = argv[0];
- opt::InputArgList Args = Tbl.parseArgs(argc, argv, OPT_UNKNOWN, Saver,
- [&](StringRef Msg) { error(Msg); });
+ opt::InputArgList Args =
+ Tbl.parseArgs(argc, argv, OPT_UNKNOWN, Saver, [&](StringRef Msg) {
+ error(Msg);
+ exit(1);
+ });
if (Args.hasArg(OPT_help)) {
Tbl.printHelp(
outs(),
More information about the llvm-commits
mailing list