[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
Tue Aug 30 00:09:57 PDT 2016
vmiklos updated this revision to Diff 69644.
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 Bar.
Index: clang-rename/USRFindingAction.cpp
===================================================================
--- clang-rename/USRFindingAction.cpp
+++ clang-rename/USRFindingAction.cpp
@@ -157,12 +157,15 @@
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 " << OldName << ".\n";
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24002.69644.patch
Type: text/x-patch
Size: 1432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160830/491941fc/attachment-0001.bin>
More information about the cfe-commits
mailing list