Generally, you need to assign a reviewer (me for clang-format changes).
Otherwise, these might just get lost on the list.
================
Comment at: lib/Format/WhitespaceManager.cpp:32
@@ -31,2 +31,3 @@
unsigned NewlinesBefore, StringRef PreviousLinePostfix,
- StringRef CurrentLinePrefix, tok::TokenKind Kind, bool
ContinuesPPDirective)
+ StringRef CurrentLinePrefix, tok::TokenKind Kind,
+ tok::ObjCKeywordKind ObjCKind, bool ContinuesPPDirective)
----------------
Manuel, what was the original reason why we don't just store a pointer to the
token?
================
Comment at: lib/Format/WhitespaceManager.cpp:239
@@ -234,1 +238,3 @@
+// Walk through all of the changed and find the property declarations to align.
+// We do so in two passes. The first will find consecutive lines which begin
----------------
"all of the changed"?
================
Comment at: lib/Format/WhitespaceManager.cpp:324-344
@@ +323,23 @@
+
+ if (Changes[i].ObjCKind == tok::objc_property) {
+ FoundPropertyOnLine = true;
+ if (StartOfSequence == 0)
+ StartOfSequence = i;
+ } else if (FoundPropertyOnLine && Changes[i].Kind == tok::r_paren &&
+ !FoundRightParenOnLine) {
+ FoundRightParenOnLine = true;
+ } else if (FoundRightParenOnLine && Changes[i].Kind == tok::semi &&
+ !FoundSemiColonOnLine) {
+ FoundSemiColonOnLine = true;
+ if (Changes[i - 1].Kind == tok::identifier) {
+ unsigned VariableChangeIndex = i - 1;
+ if (Style.PointerAlignment == FormatStyle::PAS_Right &&
+ Changes[i - 2].Kind == tok::star)
+ VariableChangeIndex = i - 2;
+ unsigned ChangeVariableColumn =
+ Changes[VariableChangeIndex].StartOfTokenColumn;
+ MinVariableColumn = std::max(MinVariableColumn, ChangeVariableColumn);
+ }
+ }
+ }
+
----------------
I am actually quite strongly against this. This essentially introduce some
additional (mini-)parser in WhitespaceManager. We have so many steps doing
parsing already that I think we really should be doing some of this there.
(This might actually also be the right thing to do for assignments, although
"parsing" those is much simple).
I think we should extend TokenAnnotator. I just looked at it and it already has
the LineType ObjCProperty. I think we should probably just re-use that in some
fashion. So the question is how do we carry information about (unwrapped) lines
to the WhitespaceManager.
Not quite sure yet how to do that. I'll take a look next week if you don't beat
me to it.
Also, if we preserved more of the token information, we would already know,
where the name of the property starts (I think).
http://reviews.llvm.org/D9433
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits