summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index f76ae86b4c6..49e21520b70 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -592,8 +592,7 @@ private:
return false;
}
}
- // There are no top-level unbalanced braces in text protos.
- return Style.Language != FormatStyle::LK_TextProto;
+ return true;
}
void updateParameterCount(FormatToken *Left, FormatToken *Current) {
@@ -713,11 +712,6 @@ private:
} else if (Contexts.back().ContextKind == tok::l_paren) {
Tok->Type = TT_InlineASMColon;
}
- // Detects trailing pieces like key:
- if ((Style.Language == FormatStyle::LK_Proto ||
- Style.Language == FormatStyle::LK_TextProto) &&
- !CurrentToken)
- return false;
break;
case tok::pipe:
case tok::amp:
@@ -804,10 +798,6 @@ private:
if (Previous && Previous->Type != TT_DictLiteral)
Previous->Type = TT_SelectorName;
}
- } else if (Style.Language == FormatStyle::LK_TextProto ||
- Style.Language == FormatStyle::LK_Proto) {
- // In TT_Proto and TT_TextProto, tok::less cannot be a binary operator.
- return false;
} else {
Tok->Type = TT_BinaryOperator;
NonTemplateLess.insert(Tok);
@@ -819,16 +809,13 @@ private:
case tok::r_square:
return false;
case tok::r_brace:
- // Lines can start with '}' except in text protos.
- if (Tok->Previous || Style.Language == FormatStyle::LK_TextProto)
+ // Lines can start with '}'.
+ if (Tok->Previous)
return false;
break;
case tok::greater:
- // In protos and text protos tok::greater cannot be a binary operator.
- if (Style.Language == FormatStyle::LK_Proto ||
- Style.Language == FormatStyle::LK_TextProto)
- return false;
- Tok->Type = TT_BinaryOperator;
+ if (Style.Language != FormatStyle::LK_TextProto)
+ Tok->Type = TT_BinaryOperator;
break;
case tok::kw_operator:
if (Style.Language == FormatStyle::LK_TextProto ||
OpenPOWER on IntegriCloud