[llvm-branch-commits] [cfe-branch] r158062 - /cfe/branches/tooling/tools/rename/ClangRename.cpp

Manuel Klimek klimek at google.com
Wed Jun 6 04:40:41 PDT 2012


Author: klimek
Date: Wed Jun  6 06:40:41 2012
New Revision: 158062

URL: http://llvm.org/viewvc/llvm-project?rev=158062&view=rev
Log:
Clean-up for ClangRename.

Patch contributed by Noah Evans.


Modified:
    cfe/branches/tooling/tools/rename/ClangRename.cpp

Modified: cfe/branches/tooling/tools/rename/ClangRename.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/rename/ClangRename.cpp?rev=158062&r1=158061&r2=158062&view=diff
==============================================================================
--- cfe/branches/tooling/tools/rename/ClangRename.cpp (original)
+++ cfe/branches/tooling/tools/rename/ClangRename.cpp Wed Jun  6 06:40:41 2012
@@ -1,4 +1,4 @@
-//=- tools/fix-llvm-style/FixLLVMStyle.cpp - Automatic LLVM style correction =//
+//=- tools/rename/ClangRename.cpp - Rename Declarations =//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,6 +7,11 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// Rename takes a declaration under a cursor (whose lines and column are 
+// specified by the -l and -c flags) respectively and renames them to the 
+// target text -t. 
+// 
+// 
 // FIXME: This is an early first draft that needs clean-up.
 //
 //===----------------------------------------------------------------------===//
@@ -143,7 +148,7 @@
 std::string getDeclarationKey(Decl *DL, ASTContext *Context) {
   Decl *D = DL->getCanonicalDecl();
   while (UsingDecl *U = dyn_cast<UsingDecl>(D)) {
-    // FIXME: If there are multiple shadow decls, we need to get that information up and awrn / error.
+    // FIXME: If there are multiple shadow decls, we need to get that information up and warn / error.
     D = (*U->shadow_begin())->getTargetDecl()->getCanonicalDecl();
   }
   ExpandedIdentifierRange R = getExpandedIdentifierRange(getIdentifierRange(D).getBegin(), Context);
@@ -246,7 +251,7 @@
   Tool.run(newFrontendActionFactory(&GetIdentifierVisitor));
   llvm::outs() << GetIdentifierVisitor.Key << "\n";
   if (GetIdentifierVisitor.Key.empty()) {
-    llvm::errs() << "Noooooooooooo!!!!!\n";
+    llvm::errs() << "No key to replace, is the specified cursor location valid?\n";
     return -1;
   }
   RenameIdentifierVisitor Renamer(GetIdentifierVisitor.Key, &Tool.getReplacements());





More information about the llvm-branch-commits mailing list