It always takes me a while to understand how clang-format's pieces fit together -- hopefully this will save me some time the next time I need it.
Details
Diff Detail
Event Timeline
lib/Format/ContinuationIndenter.h | ||
---|---|---|
35 | You are the first to introduce the term "pyhsical" line and I don't actually think it is the right term. Also, this is not a "helper class". Maybe: If an unwrapped line needs to be split over multiple lines to fit into the column limit, this class can be used to keep track of the indentation for the different levels of parentheses and to get the desired indentation for any given line break. | |
lib/Format/Format.cpp | ||
761 | /// \brief Splits a file into FormatTokens. Also, this comment adds zero information. | |
1426 | If we wanted to call them logical lines, we would have. Stick to the term unwrapped line. | |
1429 | Same here, although I think you don't even mean logical lines. | |
lib/Format/FormatToken.h | ||
110–111 | What information does this comment add? I am not against adding one, but then describe in a bit more detail what is going on. | |
lib/Format/TokenAnnotator.h | ||
39 | What's the added info? | |
152 | s/like/such as/ Also, I think that the comment is misleading. The LineType is the least important thing that this function does. It annotates all the tokens, for that parses all the expressions in it, assigned TokenTypes to the format tokens, and also annotates all Children of this line. | |
155–156 | For all tokens in \c Line, use the additional information gathered during annotation to calculate formatting hints such as required line breaks, spaces and split penalties. | |
lib/Format/UnwrappedLineFormatter.h | ||
31 | Go through all of your comments and s/logical/unwrapped/ | |
32 | And the same with s/physical//. If that removes all the information, rephrase. E.g. here: Takes a list of unwrapped lines and produces whitespace adjustments to lay them out within the column limit. | |
lib/Format/UnwrappedLineParser.h | ||
61–62 | This might be a good place to introduce the term unwrapped line. The most notable fact about unwrapped lines btw. is not that you would put them on a single line if there was no column limit. This is a nice thought model and we should also write it, but it isn't always true. More importantly, formatting decisions in one unwrapped line do not influence formatting decisions in a different unwrapped line. |
You are the first to introduce the term "pyhsical" line and I don't actually think it is the right term. Also, this is not a "helper class".
Maybe:
If an unwrapped line needs to be split over multiple lines to fit into the column limit, this class can be used to keep track of the indentation for the different levels of parentheses and to get the desired indentation for any given line break.