main.cpp is complete mess of tabs and spaces. This change brings it to compliance with LLVM coding style.
Details
Diff Detail
Event Timeline
First step would be to have warning free build.
Then we can turn "warnings as errors" on.
It looks like clang-format wasn't run over this file as it was over all the main lldb sources in the infamous universal code reformatting. That seems odd.
Anyway, it might be better just to do that to this file using the top level .clang-format. Note that you are making several choices which were not the choices made by clang-format using the .clang-format file that was used to implement this reformatting. We probably shouldn't revise that decision piecemeal.
packages/Python/lldbsuite/test/tools/lldb-server/main.cpp | ||
---|---|---|
32–43 | This change seems a shame, the original was much easier to read. | |
62–66 | clang-format moved the initial { for functions into the function definition line universally when it was run over the lldb sources. If we want to revise that decision, and go back to the initial function curly starting a line, that would be fine by me, but I don't think we should do it piecemeal. Ditto for separating the return type & function name onto separate lines. That was the way we did it originally, but the clang-format style that was chosen for the reformatting undid that. I much prefer the way you changed it to here, but that's a decision we should make globally, not file by file. |
Actually, we didn't run the clang-format over the test case source files, since we didn't want to have to deal with the possible failures resulting. So just clang-formatting this file is probably the right way to go.
It wasn't my intention to revise any formatting decisions made earlier.
I just ran 'clang-format -style=file -i main.cpp' assuming that it will actually make the file complaint with the lldb's coding style by using top level .clang-format.
Is there any document other than http://llvm.org/docs/CodingStandards.html describing LLDB coding conventions?
packages/Python/lldbsuite/test/tools/lldb-server/main.cpp | ||
---|---|---|
32–43 | Agree. But I think consistency is better than beauty in case of code formatting. | |
62–66 | Could you please elaborate. |
packages/Python/lldbsuite/test/tools/lldb-server/main.cpp | ||
---|---|---|
74 | Note to self - #elif defined(__NetBSD__) printf("%" PRIx64, static_cast<uint64_t>(_lwp_self())); and include #if defined(__NetBSD__) #include <lwp.h> #endif |
clang-format did not pick up the correct formatting because we have a .clang-format file in packages/Python/lldbsuite. This was necessary because a lot of the tests would get broken, as the formatting would break our // place breakpoint here annotations (also, stepping behavior is affected by the line breaks). It would be an interesting project to format all existing tests, but this would probably need to be done on a test-by-test basis (and may involve adding additional clang-format directives like CommentPragmas, ...).
That said, none of these problems should apply to lldb-server tests as they operate differently, so reformatting them is probably a good idea. I guess you should also then put a .clang-format file in the lldb-server test folder to make sure it stays formatted in the future.
I have added local .clang-format file. But it didn't change the way main.cpp was formated.
That's fine, I did not expect that to make a difference now. What it will do though, is make sure that any subsequent modifications conform to the formatting rules (if one runs e.g. "git clang-format"). Without this, it would pick up the .clang_format file in the parent test folder which says "don't touch anything".
LGTM.
This change seems a shame, the original was much easier to read.