[cfe-dev] RFC: Adding a rename refactoring tool to clang

Hal Finkel hfinkel at anl.gov
Fri Jul 25 13:10:47 PDT 2014


----- Original Message -----
> From: "Amin Shali" <amshali at google.com>
> To: cfe-dev at cs.uiuc.edu
> Cc: "Matthew Plant" <mplant at google.com>
> Sent: Friday, July 25, 2014 3:01:48 PM
> Subject: [cfe-dev] RFC: Adding a rename refactoring tool to clang
>
> Folks,
> 
> 
> At Google we are working on a tool and set of APIs for refactoring
> C++ programs based on LibTooling. Particularly, we have targeted
> rename refactoring for C++ as our first step.
> 
> 
> In our first iteration we want to offer two things:
> 1- A command line tool similar to clang-format which will
> semantically rename a symbol (specified by a position in a file) in
> a set of input files.
> 2- An API for doing the above task which can effectively be used to
> provide this functionality for any editor (Emacs, Vim, CodeMirror,
> etc.).
> 

Sounds neat.

> 
> == Renaming capabilities
> In the first iteration, we are offering the following features for
> the rename refactoring:
> === Supported C++ constructs:
> - Global and local variables (including function arguments)
> - Functions
> - C and CXX record types (structs/unions/classes)
> - For classes this includes renaming the constructor and destructor
> - User defined types
> - Enumerations (names and constants)
> - Record member variables and methods
> - Namespace specifiers
> - Template parameters
> - Lambda captures

What does it mean to rename a lambda capture (or an operator)?

> - Overloaded operators
> === Unsupported C++ constructs:
> - Macros
> - Symbols in comments
> 
> 
> 
> == Command line program
> === Current support:
> - Input from stdin, output to stdout
> - Input and output from/to disk
> - Option to specify include path
> - Option to predefine macros
> === Possible improvements:
> 
> - Multiple files from stdin
> 
> - Making backups of renamed files

Making a backup of the files that have been changed would be a nice feature. As would generating a patch instead of making the change in place.

 -Hal

> 
> 
> We think this tool should reside in clang-tools-extra.
> 
> 
> Please let us know what you think. Any comment and feedback is
> appreciated.
> 
> 
> Thank you.
> 
> 
> 
> 
> Λ MIN シ | amshali@ | Google Inc.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory




More information about the cfe-dev mailing list