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; } 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.