Support formatting of preprocessor branches.
We now correctly format:
void SomeFunction(int param1,
#ifdef X
NoTemplate param2,
#else
template <
#ifdef A
MyType<Some> >
#else
Type1, Type2>
#endif
param2,
#endif
param3) {
f();
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192503 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/ContinuationIndenter.cpp b/lib/Format/ContinuationIndenter.cpp
index 560e65e..aaddc34 100644
--- a/lib/Format/ContinuationIndenter.cpp
+++ b/lib/Format/ContinuationIndenter.cpp
@@ -221,7 +221,7 @@
void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
unsigned ExtraSpaces) {
- const FormatToken &Current = *State.NextToken;
+ FormatToken &Current = *State.NextToken;
const FormatToken &Previous = *State.NextToken->Previous;
if (Current.is(tok::equal) &&
(State.Line->First->is(tok::kw_for) || State.ParenLevel == 0) &&
@@ -301,7 +301,7 @@
unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
bool DryRun) {
- const FormatToken &Current = *State.NextToken;
+ FormatToken &Current = *State.NextToken;
const FormatToken &Previous = *State.NextToken->Previous;
// If we are continuing an expression, we want to indent an extra 4 spaces.
unsigned ContinuationIndent =