clang-tools  10.0.0svn
OptionsUtils.cpp
Go to the documentation of this file.
1 //===-- OptionsUtils.cpp - clang-tidy -------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "OptionsUtils.h"
10 
11 namespace clang {
12 namespace tidy {
13 namespace utils {
14 namespace options {
15 
16 static const char StringsDelimiter[] = ";";
17 
18 std::vector<std::string> parseStringList(StringRef Option) {
19  SmallVector<StringRef, 4> Names;
20  Option.split(Names, StringsDelimiter);
21  std::vector<std::string> Result;
22  for (StringRef &Name : Names) {
23  Name = Name.trim();
24  if (!Name.empty())
25  Result.push_back(Name);
26  }
27  return Result;
28 }
29 
30 std::string serializeStringList(ArrayRef<std::string> Strings) {
31  return llvm::join(Strings.begin(), Strings.end(), StringsDelimiter);
32 }
33 
34 } // namespace options
35 } // namespace utils
36 } // namespace tidy
37 } // namespace clang
std::string serializeStringList(ArrayRef< std::string > Strings)
Serialize a sequence of names that can be parsed by parseStringList.
static const char StringsDelimiter[]
std::vector< std::string > parseStringList(StringRef Option)
Parse a semicolon separated list of strings.
static constexpr llvm::StringLiteral Name
std::vector< llvm::StringRef > Strings
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static std::string join(ArrayRef< SpecialMemberFunctionsCheck::SpecialMemberFunctionKind > SMFS, llvm::StringRef AndOr)