clang-tools 10.0.0

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
clang::tidy::utils::options::serializeStringList
std::string serializeStringList(ArrayRef< std::string > Strings)
Serialize a sequence of names that can be parsed by parseStringList.
Definition: OptionsUtils.cpp:30
OptionsUtils.h
clang::tidy::utils::options::StringsDelimiter
static const char StringsDelimiter[]
Definition: OptionsUtils.cpp:16
clang::tidy::utils::options::parseStringList
std::vector< std::string > parseStringList(StringRef Option)
Parse a semicolon separated list of strings.
Definition: OptionsUtils.cpp:18
Name
static constexpr llvm::StringLiteral Name
Definition: UppercaseLiteralSuffixCheck.cpp:27
Strings
std::vector< llvm::StringRef > Strings
Definition: Serialization.cpp:195
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::tidy::cppcoreguidelines::join
static std::string join(ArrayRef< SpecialMemberFunctionsCheck::SpecialMemberFunctionKind > SMFS, llvm::StringRef AndOr)
Definition: SpecialMemberFunctionsCheck.cpp:81