Also pull #include related style out of FormatStyle as tooling::IncludeStyle.
Details
- Reviewers
ilya-biryukov - Commits
- rG7129e63bcce9: [Tooling] Pull #include manipulation code from clangFormat into libToolingCore.
rC332287: [Tooling] Pull #include manipulation code from clangFormat into libToolingCore.
rL332287: [Tooling] Pull #include manipulation code from clangFormat into libToolingCore.
Diff Detail
- Repository
- rL LLVM
Event Timeline
This change is big enough to be somewhat hard to grasp.
Maybe we could split it into two, to make it easier for review?
I.e.
- Extraction of IncludeStyle into a separate subclass.
- Moving stuff around without other refactorings.
include/clang/Format/Format.h | ||
---|---|---|
1818 ↗ | (On Diff #146042) | for the behavior is a little confusing. Could we try elaborating on what 'behavior' is a bit more? E.g. the include manipulation is done via tooling::HeaderInclude, see its documentation for more details on how include insertion points are found and which edits are produced. |
include/clang/Tooling/Core/HeaderIncludes.h | ||
22 ↗ | (On Diff #146042) | This struct looks big enough to justify putting it into a separate header. For the sake of keeping HeaderIncludes the first thing that people see when they open a file. |
112 ↗ | (On Diff #146042) | Can we move them in the current commit too? |
127 ↗ | (On Diff #146042) | Do we want const& here, i.e. have we accidentally lost &? |
The moving of IncludeStyle has been split into a separate patch D46758.
include/clang/Format/Format.h | ||
---|---|---|
1818 ↗ | (On Diff #146042) | Sure. Thanks for the suggestion! |
include/clang/Tooling/Core/HeaderIncludes.h | ||
22 ↗ | (On Diff #146042) | Good point. Branched into D46758 |
112 ↗ | (On Diff #146042) | Not yet... include sorting logics would also require refactoring in order to be moved from clang-format. |
This LG, presuming there are no semantic changes here, just moving the code around.
Also see the nits about IncludeStyle that seems to be in the wrong change...
include/clang/Tooling/Core/HeaderIncludes.h | ||
---|---|---|
112 ↗ | (On Diff #146042) | Ok, a FIXME mentioning that this class should be removed seems good enough. Thanks. |
lib/Format/Format.cpp | ||
1702 ↗ | (On Diff #146393) | It seems Style.IncludeStyle should be in the other change that pulls out IncludeStyle from FormatStyle. |
1862 ↗ | (On Diff #146393) | Here too. Shouldn't it be part of the other change? |
LGTM
lib/Format/Format.cpp | ||
---|---|---|
1702 ↗ | (On Diff #146393) | As chatted offline, we need this to pull out IncludeCategoryManager out of Format.cpp. |
- Merged with origin/master
- Make copy instead of taking references to ensure lifetime.