clang-tools 6.0.0

OptionsUtils.cpp
Go to the documentation of this file.
1 //===--- DanglingHandleCheck.cpp - clang-tidy------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "OptionsUtils.h"
11
12 namespace clang {
13 namespace tidy {
14 namespace utils {
15 namespace options {
16
17 static const char StringsDelimiter[] = ";";
18
19 std::vector<std::string> parseStringList(StringRef Option) {
20 SmallVector<StringRef, 4> Names;
21 Option.split(Names, StringsDelimiter);
22 std::vector<std::string> Result;
23 for (StringRef &Name : Names) {
24 Name = Name.trim();
25 if (!Name.empty())
26 Result.push_back(Name);
27 }
28 return Result;
29 }
30
31 std::string serializeStringList(ArrayRef<std::string> Strings) {
32 return llvm::join(Strings.begin(), Strings.end(), StringsDelimiter);
33 }
34
35 } // namespace options
36 } // namespace utils
37 } // namespace tidy
38 } // 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:31
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
OptionsUtils.h
clang::tidy::utils::options::StringsDelimiter
static const char StringsDelimiter[]
Definition: OptionsUtils.cpp:17
clang::tidy::utils::options::parseStringList
std::vector< std::string > parseStringList(StringRef Option)
Parse a semicolon separated list of strings.
Definition: OptionsUtils.cpp:19
clang
Definition: AndroidTidyModule.cpp:28
clang::tidy::cppcoreguidelines::join
static std::string join(ArrayRef< SpecialMemberFunctionsCheck::SpecialMemberFunctionKind > SMFS, llvm::StringRef AndOr)
Definition: SpecialMemberFunctionsCheck.cpp:82