summaryrefslogtreecommitdiffstats
path: root/lib/Format/FormatToken.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-01-16 09:11:55 +0000
committerDaniel Jasper <djasper@google.com>2014-01-16 09:11:55 +0000
commit034ee6a0261113b07efec739bb149fb89e215e91 (patch)
treef976627231003090e54b3620db5ffc8ebaa49ef1 /lib/Format/FormatToken.cpp
parent6bd37ee37aa8ffb7007e38735ce14f27e5784b40 (diff)
clang-format: Enable formatting of lambdas with explicit return type.
So clang-format can now format: int c = []()->int { return 2; }(); int c = []()->vector<int> { return { 2 }; }(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199368 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/FormatToken.cpp')
-rw-r--r--lib/Format/FormatToken.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Format/FormatToken.cpp b/lib/Format/FormatToken.cpp
index 0816668b57..c147dbb6b1 100644
--- a/lib/Format/FormatToken.cpp
+++ b/lib/Format/FormatToken.cpp
@@ -22,6 +22,36 @@
namespace clang {
namespace format {
+// FIXME: This is copy&pasted from Sema. Put it in a common place and remove
+// duplication.
+bool FormatToken::isSimpleTypeSpecifier() const {
+ switch (Tok.getKind()) {
+ case tok::kw_short:
+ case tok::kw_long:
+ case tok::kw___int64:
+ case tok::kw___int128:
+ case tok::kw_signed:
+ case tok::kw_unsigned:
+ case tok::kw_void:
+ case tok::kw_char:
+ case tok::kw_int:
+ case tok::kw_half:
+ case tok::kw_float:
+ case tok::kw_double:
+ case tok::kw_wchar_t:
+ case tok::kw_bool:
+ case tok::kw___underlying_type:
+ case tok::annot_typename:
+ case tok::kw_char16_t:
+ case tok::kw_char32_t:
+ case tok::kw_typeof:
+ case tok::kw_decltype:
+ return true;
+ default:
+ return false;
+ }
+}
+
TokenRole::~TokenRole() {}
void TokenRole::precomputeFormattingInfos(const FormatToken *Token) {}