I'm glad this is finally in a state to land. Thanks for the helpful reviews!
Aug 24 2017
Aug 23 2017
- Swapped checks in ContinuationIndenter
- Renamed PPMaybeIncludeGuard to IfNdefCondition and added comment
- Added another bool member that tracks if include guard detection was rejected once. If the bool gets set, the loop checking previous lines doesn't run again.
- Set lower ColumnLimit in tests
- Fixed incorrect column for \ in multi-line macros
- Resolved comment in FormatTestUtils
Aug 22 2017
Aug 17 2017
Eliminated redundancy in tests by fixing test::messUp which was incorrectly merging lines.
Aug 16 2017
Allows comments before the include guard opens. However, if there's a single non-comment line before an include-guard-like structure that meets all the other conditions then it will be treated as an include guard because Lines does not yet contain the line before the #ifndef. This looks difficult to fix and I believe it's a rare enough situation to ignore.
Aug 15 2017
Aug 10 2017
The patch now uses PPBranchLevel to track indent level. It allows PPBranchLevel to go back down to -1. The existing PPBranchLevel >= 0 checks appear to prevent indexing into structures when PPBranchLevel is -1.
Aug 9 2017
This addresses Daniel's previous concerns. The option is now an enum, the heuristic for detecting include guards is expanded and has corresponding unit tests, and style issues are resolved.
This does not yet use PPBranchLevel to track indent; I'm updating this review with my current work before addressing that point.
Aug 8 2017
I think if we need this info, we can just make it count down to -1 again (or, but that's isomorphic, let it run from 0 and make sure we never index into the data structures at 0 :)
Aug 7 2017
I resolved the formatting issues. I apologize for not paying closer attention to formatting earlier.
Ran clang-format over changes and corrected formatting
Aug 4 2017
Fix bad formatting
Pulled out getPreviousNonComment() into local variable to avoid calling twice.
Aug 3 2017
This uses FormatToken::getPreviousNonComment and adds a test. This also fixes a bug in token annotation that was breaking the test (by also using getPreviousNonComment instead of Previous)