When moving all code to new.h/cc, these code also will be formatted based on the given code style.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
First round of comments.
The patch summary says "one moved declaration." Why it is just one moved declaration? Doesn't this also support moving all classes in one file?
Maybe also mention the new behavior in the class comment.
clang-move/ClangMove.h | ||
---|---|---|
72 ↗ | (On Diff #77062) | It took me a while to understand this comment... IIUC, this is the source range of the #include directive of old.h (i.e. #include "old.h") in old.cc? |
109 ↗ | (On Diff #77062) | What about trailing comments or whitespaces? |
test/clang-move/Inputs/test.h | ||
3 ↗ | (On Diff #77062) | Maybe add some white spaces or something in the file to demonstrate that the file is copied over. |
unittests/clang-move/ClangMoveTests.cpp | ||
267 ↗ | (On Diff #77062) | Can you add tests for move all (multiple) classes in file? Not related to this patch...but it seems that we are missing test case for moving template class? |
278 ↗ | (On Diff #77062) | Maybe just insert or push back? |
280 ↗ | (On Diff #77062) | Where is foo.cc? |
299 ↗ | (On Diff #77062) | I think using namespace decl should also be ignored? |
The patch summary says "one moved declaration." Why it is just one moved declaration? Doesn't this also support moving all classes in one file?
Oh, the patch summary is not totally correct. It actually does what you mention above. Have updated the summary.
clang-move/ClangMove.h | ||
---|---|---|
72 ↗ | (On Diff #77062) | Sorry for the confusion. Indeed this a range for the written file name of #include, i.e. if the #include is #include "old.h", then the range here is for "old.h". Have updated the comment. |
109 ↗ | (On Diff #77062) | The trailing comments or whitespaces will be ignored here. We just copy this field from InclusionDirective interface, and seems there is no explicit way to retrieve the comments or whitespaces. |
unittests/clang-move/ClangMoveTests.cpp | ||
267 ↗ | (On Diff #77062) |
Yeah, moving template classes doesn't support perfectly right now. |
278 ↗ | (On Diff #77062) | I think using insert or push_back doesn't make the code as clear as initialization here. Code readers might pull up the source file to find the code for the initialized value of this variable. |
280 ↗ | (On Diff #77062) | The Code variable above represents the source code of foo.cc. |
299 ↗ | (On Diff #77062) | This case should rarely happen in source code, as many code styles prohibit using-namespace decls in headers. |
Lg with a few nits.
clang-move/ClangMove.cpp | ||
---|---|---|
539 ↗ | (On Diff #77208) | I'd probably pull this out as an inline function to save some typing. inline std::string ClangMoveTool::MakeAbsolute(Path) { return MakeAbsolutePath(OriginalRunningDirectory, OldFile)); } |
unittests/clang-move/ClangMoveTests.cpp | ||
286 ↗ | (On Diff #77208) | Please also check old header is removed or empty. |
329 ↗ | (On Diff #77208) | Please also check old headers. |