[PATCH] D148439: [clang-rename] Exit gracefully when no input provided
Shivam Gupta via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 15 11:32:12 PDT 2023
xgupta created this revision.
xgupta added reviewers: vmiklos, alexander-shaposhnikov, kbobyrev, aaron.ballman.
Herald added a project: All.
xgupta requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
clang-rename on a non existing file segfaults
Command to run -
$ clang-rename -offset=0 -new-name=plop asdasd
Error while processing llvm-project/asdasd.
clang-rename: llvm-project/llvm/include/llvm/Support/ErrorOr.h:237:
llvm::ErrorOr<T>::storage_type* llvm::ErrorOr<T>::getStorage()
[with T = const clang::FileEntry*; llvm::ErrorOr<T>::storage_type = const clang::FileEntry*]:
Assertion `!HasError && "Cannot get value when an error exists!"' failed.
[1] 827497 IOT instruction clang-rename -offset=0 -new-name=plop asdasd
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D148439
Files:
clang/tools/clang-rename/ClangRename.cpp
Index: clang/tools/clang-rename/ClangRename.cpp
===================================================================
--- clang/tools/clang-rename/ClangRename.cpp
+++ clang/tools/clang-rename/ClangRename.cpp
@@ -126,6 +126,9 @@
SymbolOffsets.push_back(Info.Offset);
NewNames.push_back(Info.NewName);
}
+ } else {
+ errs() << "clang-rename: No input provided.\n";
+ return 1;
}
// Check the arguments for correctness.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148439.513933.patch
Type: text/x-patch
Size: 451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230415/85942889/attachment.bin>
More information about the cfe-commits
mailing list