Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(468)

Issue 4526098: Implements refactoring support for multiple TUs in one process.

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 6 months ago by klimek
Modified:
13 years, 6 months ago
Reviewers:
chandlerc
Visibility:
Public.

Patch Set 1 #

Total comments: 30

Patch Set 2 : Applying review comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+281 lines, -254 lines) Patch
M examples/Tooling/RemoveCStrCalls/RemoveCStrCalls.cpp View 1 2 chunks +2 lines, -1 line 0 comments Download
M include/clang/Tooling/Refactoring.h View 1 3 chunks +65 lines, -54 lines 0 comments Download
M include/clang/Tooling/Tooling.h View 1 5 chunks +49 lines, -35 lines 0 comments Download
M lib/Tooling/Refactoring.cpp View 1 4 chunks +40 lines, -24 lines 0 comments Download
M lib/Tooling/Tooling.cpp View 1 7 chunks +102 lines, -117 lines 0 comments Download
M unittests/Tooling/RefactoringTest.cpp View 1 6 chunks +23 lines, -23 lines 0 comments Download

Messages

Total messages: 3
klimek
13 years, 6 months ago (2011-06-01 18:59:05 UTC) #1
chandlerc
Initial comments on interfaces... http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactoring.h File include/clang/Tooling/Refactoring.h (right): http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactoring.h#newcode44 include/clang/Tooling/Refactoring.h:44: /// \brief Creates a replacement ...
13 years, 6 months ago (2011-06-02 00:34:28 UTC) #2
klimek
13 years, 6 months ago (2011-06-04 04:22:53 UTC) #3
http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactoring.h
File include/clang/Tooling/Refactoring.h (right):

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactorin...
include/clang/Tooling/Refactoring.h:44: /// \brief Creates a replacement of the
range [Offset, Offset+Length[ in File
On 2011/06/02 00:34:28, chandlerc wrote:
> the second '[' should probably be a ']'

Yay European vs. American teachings. Done.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactorin...
include/clang/Tooling/Refactoring.h:47: llvm::StringRef File, unsigned Offset,
On 2011/06/02 00:34:28, chandlerc wrote:
> File is an ambiguous name here... FilePath? What form of path? (relative?
> absolute? maybe it doesn't matter..)

Added comment.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactorin...
include/clang/Tooling/Refactoring.h:49: bool operator<(const Replacement &Other)
const;
On 2011/06/02 00:34:28, chandlerc wrote:
> Comment on why this exists? This doesn't seem like an intuitively sortable
> construct to me.
> 
> If its for the de-duping below, I'd generally prefer a comparison functor
> explicit given in that context.

Put into a Less Comparator with a comment.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactorin...
include/clang/Tooling/Refactoring.h:54: /// \brief Creates a Replacement of the
range [Start, Start+Length[ with
On 2011/06/02 00:34:28, chandlerc wrote:
> Why wouldn't this accept a SourceRange? (also, same typo as above)

Added a constructor from CharSourceRange. We still want the other one for the
use case when writing tools.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactorin...
include/clang/Tooling/Refactoring.h:57: SourceManager &Sources, SourceLocation
Start, unsigned Length,
On 2011/06/02 00:34:28, chandlerc wrote:
> Sources? Not SM?
> 
> Also, why a static function instead of a constructor?

I really stumble every time I read SM.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactorin...
include/clang/Tooling/Refactoring.h:67: /// \brief A set of replacments.
On 2011/06/02 00:34:28, chandlerc wrote:
> What is the advantage of this over just using std::set?

Done.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactorin...
include/clang/Tooling/Refactoring.h:75: /// \brief Add a replacement of an AST
node's text with ReplacementText.
On 2011/06/02 00:34:28, chandlerc wrote:
> Why isn't this a templated constructor on Replacement?

Done.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactorin...
include/clang/Tooling/Refactoring.h:94: int getRangeSize(SourceManager &Sources,
const CharSourceRange &Range);
On 2011/06/02 00:34:28, chandlerc wrote:
> Why can't this be a private static function in either Replacements or
> Replacement? That would constrain its scope...

The problem is that I don't think it has anything lost there ... I want to move
that into the source manager once this code is in and we actually know we want
this, but I don't want this code review to be blocked on that change.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Refactorin...
include/clang/Tooling/Refactoring.h:108: /// This is a refactoring specific
version of \see ClangTool.
On 2011/06/02 00:34:28, chandlerc wrote:
> Why doesn't it share an interface?

Currently because I have not yet figure out the use cases on that level. Until I
have figured that out, I'd like to use as little inheritance as possible in
order keep changes easy.
I added a FIXME and would like to address that in a follow-up change.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Tooling.h
File include/clang/Tooling/Tooling.h (right):

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Tooling.h#...
include/clang/Tooling/Tooling.h:99: /// This class is written to be usable for
command line utilities.
On 2011/06/02 00:34:28, chandlerc wrote:
> I think this comment needs updating to reflect the dual usage patterns. One is
> driven through an interface for querying a database of commandlines, the other
> by parsing a single compile-like commandline. We should be very clear about
> that.

Split up.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Tooling.h#...
include/clang/Tooling/Tooling.h:106: /// RunCommandLines.
On 2011/06/02 00:34:28, chandlerc wrote:
> s/RunCommandLines/RunCommandLine/

Removed constructor.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Tooling.h#...
include/clang/Tooling/Tooling.h:109: /// \brief Construct a clang tool from a
command line.
On 2011/06/02 00:34:28, chandlerc wrote:
> Is this redundant? It should be the same as an empty tool + RunCommandLine()?
> 
> At the very least it would be good to update the documentation for this to
> clarify how it relates to the other modes of operation.

Removed the other modes.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Tooling.h#...
include/clang/Tooling/Tooling.h:143: /// Translation units not found in
JsonDatabaseDirectory will be skipped.
On 2011/06/02 00:34:28, chandlerc wrote:
> WTF is JsonDatabaseDirectory? An opaque argument that is just a stringref
needs
> *some* link to its documentation...

This is private now, and I added a node -> constructor.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Tooling.h#...
include/clang/Tooling/Tooling.h:146: const std::vector<std::string>
&TranslationUnits);
On 2011/06/02 00:34:28, chandlerc wrote:
> ArrayRef for TranslationUnites?

Done.

http://codereview.appspot.com/4526098/diff/1/include/clang/Tooling/Tooling.h#...
include/clang/Tooling/Tooling.h:156: const std::vector<std::string> &
CommandLine, FrontendAction *ToolAction);
On 2011/06/02 00:34:28, chandlerc wrote:
> no space between & and CommandLine. Also should use ArrayRef here.
 
Removed.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b