When moving all code to new.h/cc, these code also will be formatted based on the given code style.
Details
Diff Detail
- Build Status
Buildable 968 Build 968: arc lint + arc unit
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 | 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? | |
108 | What about trailing comments or whitespaces? | |
test/clang-move/Inputs/test.h | ||
3 | Maybe add some white spaces or something in the file to demonstrate that the file is copied over. | |
unittests/clang-move/ClangMoveTests.cpp | ||
267 | 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 | Maybe just insert or push back? | |
280 | Where is foo.cc? | |
299 | 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 | 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. | |
108 | 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 |
Yeah, moving template classes doesn't support perfectly right now. | |
278 | 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 | The Code variable above represents the source code of foo.cc. | |
299 | 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 | ||
---|---|---|
538 | 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 | Please also check old header is removed or empty. | |
329 | Please also check old headers. |
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?