summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2018-04-23 08:50:36 +0000
committerKrasimir Georgiev <krasimir@google.com>2018-04-23 08:50:36 +0000
commitd6824876c2a9123dd98b5053acff9d88d7b09abe (patch)
tree5067e981b1447bc1793853e6b19731fddb3e4d98 /clang/lib
parent0d5c5936cbe0ff3cf7d78ade4df52053f95fd6a1 (diff)
downloadbcm5719-llvm-d6824876c2a9123dd98b5053acff9d88d7b09abe.tar.gz
bcm5719-llvm-d6824876c2a9123dd98b5053acff9d88d7b09abe.zip
Revert "[clang-format] Improve Incomplete detection for (text) protos"
This reverts commit r330016. The incomplete detection has too many false positives, picking up typos for hard failures and refusing to format anything in that case. llvm-svn: 330569
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