[PATCH] D24002: clang-rename: improve error message when -old-name is used and could not find symbol
Miklos Vajna via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 29 13:02:19 PDT 2016
vmiklos created this revision.
vmiklos added reviewers: klimek, omtcyfz.
vmiklos added a subscriber: cfe-commits.
Old output was:
clang-rename: could not find symbol at tools/clang/tools/extra/test/clang-rename/ClassFindByName.cpp:1:1 (offset 0).
https://reviews.llvm.org/D24002
Files:
clang-rename/USRFindingAction.cpp
test/clang-rename/InvalidOldName.cpp
Index: test/clang-rename/InvalidOldName.cpp
===================================================================
--- /dev/null
+++ test/clang-rename/InvalidOldName.cpp
@@ -0,0 +1,2 @@
+// RUN: not clang-rename rename-all -new-name=Foo -old-name=Bar %s -- 2>&1 | FileCheck %s
+// CHECK: clang-rename: could not find symbol named Bar.
Index: clang-rename/USRFindingAction.cpp
===================================================================
--- clang-rename/USRFindingAction.cpp
+++ clang-rename/USRFindingAction.cpp
@@ -157,12 +157,16 @@
FoundDecl = getNamedDeclFor(Context, OldName);
}
if (FoundDecl == nullptr) {
- FullSourceLoc FullLoc(Point, SourceMgr);
- errs() << "clang-rename: could not find symbol at "
- << SourceMgr.getFilename(Point) << ":"
- << FullLoc.getSpellingLineNumber() << ":"
- << FullLoc.getSpellingColumnNumber() << " (offset " << SymbolOffset
- << ").\n";
+ if (OldName.empty()) {
+ FullSourceLoc FullLoc(Point, SourceMgr);
+ errs() << "clang-rename: could not find symbol at "
+ << SourceMgr.getFilename(Point) << ":"
+ << FullLoc.getSpellingLineNumber() << ":"
+ << FullLoc.getSpellingColumnNumber() << " (offset "
+ << SymbolOffset << ").\n";
+ } else
+ errs() << "clang-rename: could not find symbol named " << OldName
+ << ".\n";
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24002.69604.patch
Type: text/x-patch
Size: 1460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160829/123c1c1c/attachment.bin>
More information about the cfe-commits
mailing list