summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Comments.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2017-01-25 13:58:58 +0000
committerKrasimir Georgiev <krasimir@google.com>2017-01-25 13:58:58 +0000
commit91834227a3d58ecdb9e3f7300f587ab45c32ba06 (patch)
treeea69dbb58f44ddcc2ed095c59818658998aa5681 /clang/lib/Format/Comments.cpp
parentf242ffa09581e22dfd3207223ca4e4d3e9327bff (diff)
downloadbcm5719-llvm-91834227a3d58ecdb9e3f7300f587ab45c32ba06.tar.gz
bcm5719-llvm-91834227a3d58ecdb9e3f7300f587ab45c32ba06.zip
[clang-format] Implement comment reflowing.
Summary: This presents a version of the comment reflowing with less mutable state inside the comment breakable token subclasses. The state has been pushed into the driving breakProtrudingToken method. For this, the API of BreakableToken is enriched by the methods getSplitBefore and getLineLengthAfterSplitBefore. Reviewers: klimek Reviewed By: klimek Subscribers: djasper, klimek, mgorny, cfe-commits, ioeric Differential Revision: https://reviews.llvm.org/D28764 llvm-svn: 293055
Diffstat (limited to 'clang/lib/Format/Comments.cpp')
-rw-r--r--clang/lib/Format/Comments.cpp36
1 files changed, 0 insertions, 36 deletions
diff --git a/clang/lib/Format/Comments.cpp b/clang/lib/Format/Comments.cpp
deleted file mode 100644
index 1b27f5b30a6..00000000000
--- a/clang/lib/Format/Comments.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//===--- Comments.cpp - Comment Manipulation -------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file
-/// \brief Implements comment manipulation.
-///
-//===----------------------------------------------------------------------===//
-
-#include "Comments.h"
-
-namespace clang {
-namespace format {
-
-StringRef getLineCommentIndentPrefix(StringRef Comment) {
- static const char *const KnownPrefixes[] = {"///", "//", "//!"};
- StringRef LongestPrefix;
- for (StringRef KnownPrefix : KnownPrefixes) {
- if (Comment.startswith(KnownPrefix)) {
- size_t PrefixLength = KnownPrefix.size();
- while (PrefixLength < Comment.size() && Comment[PrefixLength] == ' ')
- ++PrefixLength;
- if (PrefixLength > LongestPrefix.size())
- LongestPrefix = Comment.substr(0, PrefixLength);
- }
- }
- return LongestPrefix;
-}
-
-} // namespace format
-} // namespace clang
OpenPOWER on IntegriCloud