[PATCH] D95078: [clang-format] [NFC] Use some constexpr StringRef instead of const char*.
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 20 12:37:38 PST 2021
HazardyKnusperkeks created this revision.
HazardyKnusperkeks added reviewers: MyDeveloperDay, curdeius.
HazardyKnusperkeks added a project: clang-format.
HazardyKnusperkeks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95078
Files:
clang/lib/Format/BreakableToken.cpp
Index: clang/lib/Format/BreakableToken.cpp
===================================================================
--- clang/lib/Format/BreakableToken.cpp
+++ clang/lib/Format/BreakableToken.cpp
@@ -25,7 +25,7 @@
namespace clang {
namespace format {
-static const char *const Blanks = " \t\v\f\r";
+static constexpr StringRef Blanks = " \t\v\f\r";
static bool IsBlank(char C) {
switch (C) {
case ' ':
@@ -41,11 +41,11 @@
static StringRef getLineCommentIndentPrefix(StringRef Comment,
const FormatStyle &Style) {
- static const char *const KnownCStylePrefixes[] = {"///<", "//!<", "///",
- "//", "//!", "//:"};
- static const char *const KnownTextProtoPrefixes[] = {"//", "#", "##", "###",
- "####"};
- ArrayRef<const char *> KnownPrefixes(KnownCStylePrefixes);
+ static constexpr StringRef KnownCStylePrefixes[] = {"///<", "//!<", "///",
+ "//", "//!", "//:"};
+ static constexpr StringRef KnownTextProtoPrefixes[] = {"//", "#", "##", "###",
+ "####"};
+ ArrayRef<StringRef> KnownPrefixes(KnownCStylePrefixes);
if (Style.Language == FormatStyle::LK_TextProto)
KnownPrefixes = KnownTextProtoPrefixes;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95078.317971.patch
Type: text/x-patch
Size: 1391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210120/9903b6d1/attachment.bin>
More information about the cfe-commits
mailing list